summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiam Murphy <liampm32@gmail.com>2021-08-05 15:35:50 +1000
committerLiam Murphy <liampm32@gmail.com>2021-08-05 15:35:50 +1000
commit53e66a383f2859002f7b09c2708c0dacd754176d (patch)
treec8b8d8d36e71caba7e2d8be294bb8382c57a563f
parentcfa1f61154193da9a12420cb9cf300b2f3d736b2 (diff)
downloadembassy-53e66a383f2859002f7b09c2708c0dacd754176d.zip
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.
-rw-r--r--embassy-macros/src/lib.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/embassy-macros/src/lib.rs b/embassy-macros/src/lib.rs
index 3dc295fc..d00baebf 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