diff --git a/embassy-macros/src/macros/task.rs b/embassy-macros/src/macros/task.rs index f0c78c59..0cf6b423 100644 --- a/embassy-macros/src/macros/task.rs +++ b/embassy-macros/src/macros/task.rs @@ -61,10 +61,14 @@ pub fn run(args: syn::AttributeArgs, mut f: syn::ItemFn) -> Result Result #embassy_path::executor::SpawnToken<#impl_ty> { - use #embassy_path::executor::raw::TaskStorage; + #visibility fn #task_ident(#fargs) -> #spawn_token<#future_ident> { #f - type F = #impl_ty; + + #[allow(non_upper_case_globals)] #[allow(clippy::declare_interior_mutable_const)] - const NEW_TASK: TaskStorage = TaskStorage::new(); - static POOL: [TaskStorage; #pool_size] = [NEW_TASK; #pool_size]; - unsafe { TaskStorage::spawn_pool(&POOL, move || task(#arg_names)) } + const #new_ts_ident: #task_storage<#future_ident> = #task_storage::new(); + + #[allow(non_upper_case_globals)] + static #pool_ident: [#task_storage<#future_ident>; #pool_size] = [#new_ts_ident; #pool_size]; + + unsafe { #task_storage::spawn_pool(&#pool_ident, move || #task_inner_ident(#arg_names)) } } }; diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 72a83246..e73ef7e9 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,6 +1,6 @@ # Before upgrading check that everything is available on all tier1 targets here: # https://rust-lang.github.io/rustup-components-history [toolchain] -channel = "nightly-2022-03-10" +channel = "nightly-2022-04-24" components = [ "rust-src", "rustfmt" ] targets = [ "thumbv7em-none-eabi", "thumbv7m-none-eabi", "thumbv6m-none-eabi", "thumbv7em-none-eabihf", "thumbv8m.main-none-eabihf", "wasm32-unknown-unknown" ]