aboutsummaryrefslogtreecommitdiff
path: root/macros/src/codegen/resources_struct.rs
diff options
context:
space:
mode:
authorGravatar bors[bot] <26634292+bors[bot]@users.noreply.github.com> 2020-09-04 07:50:13 +0000
committerGravatar GitHub <noreply@github.com> 2020-09-04 07:50:13 +0000
commit7506bd8ae0ba335fc058c2138438fab5f20f6dab (patch)
treefe65b335b19171370bd6be0bd5cd6b776a1d6110 /macros/src/codegen/resources_struct.rs
parentc5e6d1fa49e3596227a8ee8fe89e2e4f66db3169 (diff)
parentad2b80907899cc335edcebfc77ae4b4b51272b87 (diff)
downloadrtic-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/resources_struct.rs')
-rw-r--r--macros/src/codegen/resources_struct.rs17
1 files changed, 6 insertions, 11 deletions
diff --git a/macros/src/codegen/resources_struct.rs b/macros/src/codegen/resources_struct.rs
index 994e751c..dbbba30e 100644
--- a/macros/src/codegen/resources_struct.rs
+++ b/macros/src/codegen/resources_struct.rs
@@ -14,8 +14,8 @@ pub fn codegen(
let mut lt = None;
let resources = match ctxt {
- Context::Init(core) => &app.inits[&core].args.resources,
- Context::Idle(core) => &app.idles[&core].args.resources,
+ Context::Init => &app.inits.first().unwrap().args.resources,
+ Context::Idle => &app.idles.first().unwrap().args.resources,
Context::HardwareTask(name) => &app.hardware_tasks[name].args.resources,
Context::SoftwareTask(name) => &app.software_tasks[name].args.resources,
};
@@ -39,7 +39,7 @@ pub fn codegen(
if ctxt.is_init() {
if !analysis.ownerships.contains_key(name) {
- // owned by `init`
+ // Owned by `init`
fields.push(quote!(
#(#cfgs)*
pub #name: &'static #mut_ #ty
@@ -50,7 +50,7 @@ pub fn codegen(
#name: &#mut_ #name
));
} else {
- // owned by someone else
+ // Owned by someone else
lt = Some(quote!('a));
fields.push(quote!(
@@ -75,7 +75,7 @@ pub fn codegen(
pub #name: &'a #ty
));
} else {
- // resource proxy
+ // Resource proxy
lt = Some(quote!('a));
fields.push(quote!(
@@ -136,7 +136,7 @@ pub fn codegen(
if lt.is_some() {
*needs_lt = true;
- // the struct could end up empty due to `cfg`s leading to an error due to `'a` being unused
+ // The struct could end up empty due to `cfg`s leading to an error due to `'a` being unused
if has_cfgs {
fields.push(quote!(
#[doc(hidden)]
@@ -147,13 +147,9 @@ pub fn codegen(
}
}
- let core = ctxt.core(app);
- let cores = app.args.cores;
- let cfg_core = util::cfg_core(core, cores);
let doc = format!("Resources `{}` has access to", ctxt.ident(app));
let ident = util::resources_ident(ctxt, app);
let item = quote!(
- #cfg_core
#[allow(non_snake_case)]
#[doc = #doc]
pub struct #ident<#lt> {
@@ -167,7 +163,6 @@ pub fn codegen(
Some(quote!(priority: &#lt rtic::export::Priority))
};
let constructor = quote!(
- #cfg_core
impl<#lt> #ident<#lt> {
#[inline(always)]
unsafe fn new(#arg) -> Self {