macros/main: copy fn return to task.

This prevents this bad code from compiling.

```rust
async fn main(_spawner: Spawner) -> ! {
    // not really noreturn!
}
```
This commit is contained in:
Dario Nieuwenhuis 2023-03-08 02:03:39 +01:00
parent a614e697d0
commit e7a19a9725

View File

@ -105,10 +105,11 @@ pub fn run(args: syn::AttributeArgs, f: syn::ItemFn, main: TokenStream) -> Resul
ctxt.check()?; ctxt.check()?;
let f_body = f.block; let f_body = f.block;
let out = &f.sig.output;
let result = quote! { let result = quote! {
#[::embassy_executor::task()] #[::embassy_executor::task()]
async fn __embassy_main(#fargs) { async fn __embassy_main(#fargs) #out {
#f_body #f_body
} }