From 2d0072a17b5a20966304d623374cc56695b0ab5a Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Thu, 12 Sep 2019 11:26:40 -0700 Subject: [PATCH] attributes: fix async fn not moving args into body (#342) This fixes compilation errors with `#[instrument]`ed `async fn`s on the latest nightly. The generated `async` block was not `async move`, so the function's attributes were not moved into it. Signed-off-by: Eliza Weisman --- tracing-attributes/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tracing-attributes/src/lib.rs b/tracing-attributes/src/lib.rs index f5220859dc..83cd903468 100644 --- a/tracing-attributes/src/lib.rs +++ b/tracing-attributes/src/lib.rs @@ -170,7 +170,7 @@ pub fn instrument(args: TokenStream, item: TokenStream) -> TokenStream { let await_kwd = syn::Ident::new("await", block.span()); quote_spanned! {block.span()=> tracing_futures::Instrument::instrument( - #async_kwd { #block }, + #async_kwd move { #block }, __tracing_attr_span ) .#await_kwd