Fix macro if user crate is not using feature(const_in_array_repeat_expressions)

This commit is contained in:
Dario Nieuwenhuis 2021-02-23 23:05:18 +01:00
parent 67c03e1a38
commit 465ca9086d

View File

@ -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<F>; #pool_size] = [::embassy::executor::Task::new(); #pool_size];
const NEW_TASK: ::embassy::executor::Task<F> = ::embassy::executor::Task::new();
static POOL: [::embassy::executor::Task<F>; #pool_size] = [NEW_TASK; #pool_size];
unsafe { ::embassy::executor::Task::spawn(&POOL, move || task(#arg_names)) }
}
};