From 465ca9086d9680d2788d3d98c1c6a8c55a27f073 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Tue, 23 Feb 2021 23:05:18 +0100 Subject: [PATCH] Fix macro if user crate is not using feature(const_in_array_repeat_expressions) --- embassy-macros/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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)) } } };