Merge pull request #729 from embassy-rs/update-nightly
Update Rust nightly.
This commit is contained in:
commit
b578e060d7
2 changed files with 23 additions and 9 deletions
|
@ -61,10 +61,14 @@ pub fn run(args: syn::AttributeArgs, mut f: syn::ItemFn) -> Result<TokenStream,
|
||||||
|
|
||||||
ctxt.check()?;
|
ctxt.check()?;
|
||||||
|
|
||||||
let name = f.sig.ident.clone();
|
let task_ident = f.sig.ident.clone();
|
||||||
|
let task_inner_ident = format_ident!("__{}_task", task_ident);
|
||||||
|
let future_ident = format_ident!("__{}_Future", task_ident);
|
||||||
|
let pool_ident = format_ident!("__{}_POOL", task_ident);
|
||||||
|
let new_ts_ident = format_ident!("__{}_NEW_TASKSTORAGE", task_ident);
|
||||||
|
|
||||||
let visibility = &f.vis;
|
let visibility = &f.vis;
|
||||||
f.sig.ident = format_ident!("task");
|
f.sig.ident = task_inner_ident.clone();
|
||||||
let impl_ty = if args.send {
|
let impl_ty = if args.send {
|
||||||
quote!(impl ::core::future::Future + Send + 'static)
|
quote!(impl ::core::future::Future + Send + 'static)
|
||||||
} else {
|
} else {
|
||||||
|
@ -73,16 +77,26 @@ pub fn run(args: syn::AttributeArgs, mut f: syn::ItemFn) -> Result<TokenStream,
|
||||||
|
|
||||||
let attrs = &f.attrs;
|
let attrs = &f.attrs;
|
||||||
|
|
||||||
|
let spawn_token = quote!(#embassy_path::executor::SpawnToken);
|
||||||
|
let task_storage = quote!(#embassy_path::executor::raw::TaskStorage);
|
||||||
|
|
||||||
let result = quote! {
|
let result = quote! {
|
||||||
|
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
|
type #future_ident = #impl_ty;
|
||||||
|
|
||||||
#(#attrs)*
|
#(#attrs)*
|
||||||
#visibility fn #name(#fargs) -> #embassy_path::executor::SpawnToken<#impl_ty> {
|
#visibility fn #task_ident(#fargs) -> #spawn_token<#future_ident> {
|
||||||
use #embassy_path::executor::raw::TaskStorage;
|
|
||||||
#f
|
#f
|
||||||
type F = #impl_ty;
|
|
||||||
|
#[allow(non_upper_case_globals)]
|
||||||
#[allow(clippy::declare_interior_mutable_const)]
|
#[allow(clippy::declare_interior_mutable_const)]
|
||||||
const NEW_TASK: TaskStorage<F> = TaskStorage::new();
|
const #new_ts_ident: #task_storage<#future_ident> = #task_storage::new();
|
||||||
static POOL: [TaskStorage<F>; #pool_size] = [NEW_TASK; #pool_size];
|
|
||||||
unsafe { TaskStorage::spawn_pool(&POOL, move || task(#arg_names)) }
|
#[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)) }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Before upgrading check that everything is available on all tier1 targets here:
|
# Before upgrading check that everything is available on all tier1 targets here:
|
||||||
# https://rust-lang.github.io/rustup-components-history
|
# https://rust-lang.github.io/rustup-components-history
|
||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "nightly-2022-03-10"
|
channel = "nightly-2022-04-24"
|
||||||
components = [ "rust-src", "rustfmt" ]
|
components = [ "rust-src", "rustfmt" ]
|
||||||
targets = [ "thumbv7em-none-eabi", "thumbv7m-none-eabi", "thumbv6m-none-eabi", "thumbv7em-none-eabihf", "thumbv8m.main-none-eabihf", "wasm32-unknown-unknown" ]
|
targets = [ "thumbv7em-none-eabi", "thumbv7m-none-eabi", "thumbv6m-none-eabi", "thumbv7em-none-eabihf", "thumbv8m.main-none-eabihf", "wasm32-unknown-unknown" ]
|
||||||
|
|
Loading…
Reference in a new issue