From e7a19a97259a5d3055db7164bc162ad7c7035420 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Wed, 8 Mar 2023 02:03:39 +0100 Subject: [PATCH] macros/main: copy fn return to task. This prevents this bad code from compiling. ```rust async fn main(_spawner: Spawner) -> ! { // not really noreturn! } ``` --- embassy-macros/src/macros/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/embassy-macros/src/macros/main.rs b/embassy-macros/src/macros/main.rs index 7af4ef83..6ae77398 100644 --- a/embassy-macros/src/macros/main.rs +++ b/embassy-macros/src/macros/main.rs @@ -105,10 +105,11 @@ pub fn run(args: syn::AttributeArgs, f: syn::ItemFn, main: TokenStream) -> Resul ctxt.check()?; let f_body = f.block; + let out = &f.sig.output; let result = quote! { #[::embassy_executor::task()] - async fn __embassy_main(#fargs) { + async fn __embassy_main(#fargs) #out { #f_body }