From 53e66a383f2859002f7b09c2708c0dacd754176d Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Thu, 5 Aug 2021 15:35:50 +1000 Subject: [PATCH] Forward attributes to generated task function Fixes #18 Syn considers doc comments to be attributes, so forwarding those fixes the issue. It's probably a good idea to forward most attributes anyway. --- embassy-macros/src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/embassy-macros/src/lib.rs b/embassy-macros/src/lib.rs index 3dc295fc1..d00baebfe 100644 --- a/embassy-macros/src/lib.rs +++ b/embassy-macros/src/lib.rs @@ -110,7 +110,10 @@ pub fn task(args: TokenStream, item: TokenStream) -> TokenStream { quote!(impl ::core::future::Future + 'static) }; + let attrs = &task_fn.attrs; + let result = quote! { + #(#attrs)* #visibility fn #name(#args) -> #embassy_path::executor::SpawnToken<#impl_ty> { use #embassy_path::executor::raw::Task; #task_fn