diff --git a/embassy-macros/src/lib.rs b/embassy-macros/src/lib.rs index c3ccb6d0f..e77cd9bc2 100644 --- a/embassy-macros/src/lib.rs +++ b/embassy-macros/src/lib.rs @@ -102,7 +102,8 @@ pub fn task(args: TokenStream, item: TokenStream) -> TokenStream { #visibility fn #name(#args) -> ::embassy::executor::SpawnToken<#impl_ty> { #task_fn type F = #impl_ty; - static POOL: [::embassy::executor::Task; #pool_size] = [::embassy::executor::Task::new(); #pool_size]; + const NEW_TASK: ::embassy::executor::Task = ::embassy::executor::Task::new(); + static POOL: [::embassy::executor::Task; #pool_size] = [NEW_TASK; #pool_size]; unsafe { ::embassy::executor::Task::spawn(&POOL, move || task(#arg_names)) } } };