@@ -203,95 +203,83 @@ cfg_if! {
203203 macro_rules! f {
204204 ( $(
205205 $( #[ $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
209208 ) * ) => ( $(
210209 #[ inline]
211210 $( #[ $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
215213 ) * )
216214 }
217215
218216 /// Define a safe function that is const as long as `const-extern-fn` is enabled.
219217 macro_rules! safe_f {
220218 ( $(
221219 $( #[ $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
225222 ) * ) => ( $(
226223 #[ inline]
227224 $( #[ $attr] ) *
228- pub $( $constness) * extern fn $i( $( $arg: $argty) , * ) -> $ret {
229- $( $body) ; *
230- }
225+ pub $( $constness) * extern fn $i( $( $arg: $argty) , * ) -> $ret
226+ $body
231227 ) * )
232228 }
233229
234230 /// A nonpublic function that is const as long as `const-extern-fn` is enabled.
235231 macro_rules! const_fn {
236232 ( $(
237233 $( #[ $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
241236 ) * ) => ( $(
242237 #[ inline]
243238 $( #[ $attr] ) *
244- $( $constness) * fn $i( $( $arg: $argty) , * ) -> $ret {
245- $( $body) ; *
246- }
239+ $( $constness) * fn $i( $( $arg: $argty) , * ) -> $ret
240+ $body
247241 ) * )
248242 }
249243 } else {
250244 /// Define an `unsafe` function that is const as long as `const-extern-fn` is enabled.
251245 macro_rules! f {
252246 ( $(
253247 $( #[ $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
257250 ) * ) => ( $(
258251 #[ inline]
259252 $( #[ $attr] ) *
260- pub unsafe extern fn $i( $( $arg: $argty) , * ) -> $ret {
261- $( $body) ; *
262- }
253+ pub unsafe extern fn $i( $( $arg: $argty) , * ) -> $ret
254+ $body
263255 ) * )
264256 }
265257
266258 /// Define a safe function that is const as long as `const-extern-fn` is enabled.
267259 macro_rules! safe_f {
268260 ( $(
269261 $( #[ $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
273264 ) * ) => ( $(
274265 #[ inline]
275266 $( #[ $attr] ) *
276- pub extern fn $i( $( $arg: $argty) , * ) -> $ret {
277- $( $body) ; *
278- }
267+ pub extern fn $i( $( $arg: $argty) , * ) -> $ret
268+ $body
279269 ) * )
280270 }
281271
282272 /// A nonpublic function that is const as long as `const-extern-fn` is enabled.
283273 macro_rules! const_fn {
284274 ( $(
285275 $( #[ $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
289278 ) * ) => ( $(
290279 #[ inline]
291280 $( #[ $attr] ) *
292- fn $i( $( $arg: $argty) , * ) -> $ret {
293- $( $body) ; *
294- }
281+ fn $i( $( $arg: $argty) , * ) -> $ret
282+ $body
295283 ) * )
296284 }
297285 }
0 commit comments