diff options
author | 2020-09-04 07:50:13 +0000 | |
---|---|---|
committer | 2020-09-04 07:50:13 +0000 | |
commit | 7506bd8ae0ba335fc058c2138438fab5f20f6dab (patch) | |
tree | fe65b335b19171370bd6be0bd5cd6b776a1d6110 /macros/src/codegen/assertions.rs | |
parent | c5e6d1fa49e3596227a8ee8fe89e2e4f66db3169 (diff) | |
parent | ad2b80907899cc335edcebfc77ae4b4b51272b87 (diff) | |
download | rtic-7506bd8ae0ba335fc058c2138438fab5f20f6dab.tar.gz rtic-7506bd8ae0ba335fc058c2138438fab5f20f6dab.tar.zst rtic-7506bd8ae0ba335fc058c2138438fab5f20f6dab.zip |
Merge #355
355: Multi-core removal r=korken89 a=AfoHT
Dependent on https://github.com/rtic-rs/rtic-syntax/pull/27
With the same reasoning as ^^
For now the testing is done against my rtic-syntax/multiremove-branch, but before we merge it should corrected.
Co-authored-by: Henrik Tjäder <henrik@tjaders.com>
Diffstat (limited to 'macros/src/codegen/assertions.rs')
-rw-r--r-- | macros/src/codegen/assertions.rs | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/macros/src/codegen/assertions.rs b/macros/src/codegen/assertions.rs index 51bbdbff..4d9aae47 100644 --- a/macros/src/codegen/assertions.rs +++ b/macros/src/codegen/assertions.rs @@ -1,32 +1,18 @@ use proc_macro2::TokenStream as TokenStream2; use quote::quote; -use crate::{analyze::Analysis, check::Extra}; +use crate::analyze::Analysis; /// Generates compile-time assertions that check that types implement the `Send` / `Sync` traits -pub fn codegen(core: u8, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream2> { +pub fn codegen(analysis: &Analysis) -> Vec<TokenStream2> { let mut stmts = vec![]; - // we don't generate *all* assertions on all cores because the user could conditionally import a - // type only on some core (e.g. `#[cfg(core = "0")] use some::Type;`) - - if let Some(types) = analysis.send_types.get(&core) { - for ty in types { - stmts.push(quote!(rtic::export::assert_send::<#ty>();)); - } - } - - if let Some(types) = analysis.sync_types.get(&core) { - for ty in types { - stmts.push(quote!(rtic::export::assert_sync::<#ty>();)); - } + for ty in &analysis.send_types { + stmts.push(quote!(rtic::export::assert_send::<#ty>();)); } - // if the `schedule` API is used in more than one core then we need to check that the - // `monotonic` timer can be used in multi-core context - if analysis.timer_queues.len() > 1 && analysis.timer_queues.contains_key(&core) { - let monotonic = extra.monotonic(); - stmts.push(quote!(rtic::export::assert_multicore::<#monotonic>();)); + for ty in &analysis.sync_types { + stmts.push(quote!(rtic::export::assert_sync::<#ty>();)); } stmts |