File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -159,6 +159,7 @@ pub fn test(_attr: TokenStream, item: TokenStream) -> TokenStream {
159
159
pub fn bench ( _attr : TokenStream , item : TokenStream ) -> TokenStream {
160
160
let input = syn:: parse_macro_input!( item as syn:: ItemFn ) ;
161
161
162
+ let ret = & input. sig . output ;
162
163
let args = & input. sig . inputs ;
163
164
let name = & input. sig . ident ;
164
165
let body = & input. block ;
@@ -179,10 +180,12 @@ pub fn bench(_attr: TokenStream, item: TokenStream) -> TokenStream {
179
180
let result = quote ! {
180
181
#[ bench]
181
182
#( #attrs) *
182
- fn #name( b: & mut test:: Bencher ) {
183
- b. iter( || {
184
- let _ = async_std:: task:: block_on( async { #body } ) ;
185
- } ) ;
183
+ fn #name( b: & mut test:: Bencher ) #ret {
184
+ task:: block_on( task:: spawn( async {
185
+ b. iter( || {
186
+ #body
187
+ } )
188
+ } ) )
186
189
}
187
190
} ;
188
191
You can’t perform that action at this time.
0 commit comments