File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 11use proc_macro:: TokenStream ;
22use quote:: quote;
33
4- pub ( crate ) fn test ( _: TokenStream , item : TokenStream ) -> TokenStream {
4+ pub ( crate ) fn test ( args : TokenStream , item : TokenStream ) -> TokenStream {
5+ if !args. is_empty ( ) {
6+ return syn:: Error :: new_spanned ( args, "invalid argument" ) )
7+ . to_compile_error ( )
8+ . into ( ) ;
9+ }
510 let mut input = syn:: parse_macro_input!( item as syn:: ItemFn ) ;
611 let attrs = & input. attrs ;
712 let vis = & input. vis ;
813 let sig = & mut input. sig ;
914 let body = & input. block ;
1015
11- if sig. asyncness . is_none ( ) {
16+ if sig. asyncness . take ( ) . is_none ( ) {
1217 return syn:: Error :: new_spanned ( sig. fn_token , "Only async functions are supported" )
1318 . to_compile_error ( )
1419 . into ( ) ;
1520 }
1621
17- sig. asyncness = None ;
18-
1922 let gen = quote ! {
23+ #[ :: core:: prelude:: v1:: test]
2024 #( #attrs) *
2125 #vis #sig {
22- :: futures_test:: __private:: block_on( async move { #body } )
26+ :: futures_test:: __private:: block_on( async move #body)
2327 }
2428 } ;
2529
You can’t perform that action at this time.
0 commit comments