@@ -203,95 +203,83 @@ cfg_if! {
203
203
macro_rules! f {
204
204
( $(
205
205
$( #[ $attr: meta] ) *
206
- pub $( { $constness: ident} ) * fn $i: ident( $( $arg: ident: $argty: ty) , * ) -> $ret: ty {
207
- $( $body: stmt) ; *
208
- }
206
+ pub $( { $constness: ident} ) * fn $i: ident( $( $arg: ident: $argty: ty) , * $( , ) ?) -> $ret: ty
207
+ $body: block
209
208
) * ) => ( $(
210
209
#[ inline]
211
210
$( #[ $attr] ) *
212
- pub $( $constness) * unsafe extern fn $i( $( $arg: $argty) , * ) -> $ret {
213
- $( $body) ; *
214
- }
211
+ pub $( $constness) * unsafe extern fn $i( $( $arg: $argty) , * ) -> $ret
212
+ $body
215
213
) * )
216
214
}
217
215
218
216
/// Define a safe function that is const as long as `const-extern-fn` is enabled.
219
217
macro_rules! safe_f {
220
218
( $(
221
219
$( #[ $attr: meta] ) *
222
- pub $( { $constness: ident} ) * fn $i: ident( $( $arg: ident: $argty: ty) , * ) -> $ret: ty {
223
- $( $body: stmt) ; *
224
- }
220
+ pub $( { $constness: ident} ) * fn $i: ident( $( $arg: ident: $argty: ty) , * $( , ) ?) -> $ret: ty
221
+ $body: block
225
222
) * ) => ( $(
226
223
#[ inline]
227
224
$( #[ $attr] ) *
228
- pub $( $constness) * extern fn $i( $( $arg: $argty) , * ) -> $ret {
229
- $( $body) ; *
230
- }
225
+ pub $( $constness) * extern fn $i( $( $arg: $argty) , * ) -> $ret
226
+ $body
231
227
) * )
232
228
}
233
229
234
230
/// A nonpublic function that is const as long as `const-extern-fn` is enabled.
235
231
macro_rules! const_fn {
236
232
( $(
237
233
$( #[ $attr: meta] ) *
238
- $( { $constness: ident} ) * fn $i: ident( $( $arg: ident: $argty: ty) , * ) -> $ret: ty {
239
- $( $body: stmt) ; *
240
- }
234
+ $( { $constness: ident} ) * fn $i: ident( $( $arg: ident: $argty: ty) , * $( , ) ?) -> $ret: ty
235
+ $body: block
241
236
) * ) => ( $(
242
237
#[ inline]
243
238
$( #[ $attr] ) *
244
- $( $constness) * fn $i( $( $arg: $argty) , * ) -> $ret {
245
- $( $body) ; *
246
- }
239
+ $( $constness) * fn $i( $( $arg: $argty) , * ) -> $ret
240
+ $body
247
241
) * )
248
242
}
249
243
} else {
250
244
/// Define an `unsafe` function that is const as long as `const-extern-fn` is enabled.
251
245
macro_rules! f {
252
246
( $(
253
247
$( #[ $attr: meta] ) *
254
- pub $( { $constness: ident} ) * fn $i: ident( $( $arg: ident: $argty: ty) , * ) -> $ret: ty {
255
- $( $body: stmt) ; *
256
- }
248
+ pub $( { $constness: ident} ) * fn $i: ident( $( $arg: ident: $argty: ty) , * $( , ) ?) -> $ret: ty
249
+ $body: block
257
250
) * ) => ( $(
258
251
#[ inline]
259
252
$( #[ $attr] ) *
260
- pub unsafe extern fn $i( $( $arg: $argty) , * ) -> $ret {
261
- $( $body) ; *
262
- }
253
+ pub unsafe extern fn $i( $( $arg: $argty) , * ) -> $ret
254
+ $body
263
255
) * )
264
256
}
265
257
266
258
/// Define a safe function that is const as long as `const-extern-fn` is enabled.
267
259
macro_rules! safe_f {
268
260
( $(
269
261
$( #[ $attr: meta] ) *
270
- pub $( { $constness: ident} ) * fn $i: ident( $( $arg: ident: $argty: ty) , * ) -> $ret: ty {
271
- $( $body: stmt) ; *
272
- }
262
+ pub $( { $constness: ident} ) * fn $i: ident( $( $arg: ident: $argty: ty) , * $( , ) ?) -> $ret: ty
263
+ $body: block
273
264
) * ) => ( $(
274
265
#[ inline]
275
266
$( #[ $attr] ) *
276
- pub extern fn $i( $( $arg: $argty) , * ) -> $ret {
277
- $( $body) ; *
278
- }
267
+ pub extern fn $i( $( $arg: $argty) , * ) -> $ret
268
+ $body
279
269
) * )
280
270
}
281
271
282
272
/// A nonpublic function that is const as long as `const-extern-fn` is enabled.
283
273
macro_rules! const_fn {
284
274
( $(
285
275
$( #[ $attr: meta] ) *
286
- $( { $constness: ident} ) * fn $i: ident( $( $arg: ident: $argty: ty) , * ) -> $ret: ty {
287
- $( $body: stmt) ; *
288
- }
276
+ $( { $constness: ident} ) * fn $i: ident( $( $arg: ident: $argty: ty) , * $( , ) ?) -> $ret: ty
277
+ $body: block
289
278
) * ) => ( $(
290
279
#[ inline]
291
280
$( #[ $attr] ) *
292
- fn $i( $( $arg: $argty) , * ) -> $ret {
293
- $( $body) ; *
294
- }
281
+ fn $i( $( $arg: $argty) , * ) -> $ret
282
+ $body
295
283
) * )
296
284
}
297
285
}
0 commit comments