diff options
author | Carl Lerche <me@carllerche.com> | 2019-04-30 19:55:22 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-30 19:55:22 -0700 |
commit | 4ef736b9d5ac41b2548eaf7c59a00a63b2633ba4 (patch) | |
tree | 9029d318d3f86c9b8c699a8ed5de906ddde3608b /tokio-macros | |
parent | 219f24cbf16abf7e1ba321e15bcfd5b6615eb746 (diff) |
async-await: add `current_thread::Runtime::block_on_async` (#1072)
This function is used by the Tokio macros introduced by #1058 but was
omitted from the PR.
Diffstat (limited to 'tokio-macros')
-rw-r--r-- | tokio-macros/src/lib.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tokio-macros/src/lib.rs b/tokio-macros/src/lib.rs index afe3b1f5..d501f743 100644 --- a/tokio-macros/src/lib.rs +++ b/tokio-macros/src/lib.rs @@ -58,6 +58,7 @@ pub fn test(_attr: TokenStream, item: TokenStream) -> TokenStream { let ret = &input.decl.output; let name = &input.ident; let body = &input.block; + let attrs = &input.attrs; if input.asyncness.is_none() { let tokens = quote_spanned! { input.span() => @@ -69,6 +70,7 @@ pub fn test(_attr: TokenStream, item: TokenStream) -> TokenStream { let result = quote! { #[test] + #(#attrs)* fn #name() #ret { let mut rt = tokio::runtime::current_thread::Runtime::new().unwrap(); rt.block_on_async(async { #body }) |