diff options
author | 2023-01-07 11:24:13 +0100 | |
---|---|---|
committer | 2023-03-01 00:31:06 +0100 | |
commit | 714020a624ca93c42d5da7ebe612e7fc668e1471 (patch) | |
tree | 798716e0fd29d0b6235bb5bbec2dd11dba658ecc /macros/src/codegen/software_tasks.rs | |
parent | 53f3d397e76383deabbe9579a3522174c422a958 (diff) | |
download | rtic-714020a624ca93c42d5da7ebe612e7fc668e1471.tar.gz rtic-714020a624ca93c42d5da7ebe612e7fc668e1471.tar.zst rtic-714020a624ca93c42d5da7ebe612e7fc668e1471.zip |
Removed Priority, simplified lifetime handling
Diffstat (limited to 'macros/src/codegen/software_tasks.rs')
-rw-r--r-- | macros/src/codegen/software_tasks.rs | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/macros/src/codegen/software_tasks.rs b/macros/src/codegen/software_tasks.rs index b2b468ca..350c1e60 100644 --- a/macros/src/codegen/software_tasks.rs +++ b/macros/src/codegen/software_tasks.rs @@ -36,16 +36,11 @@ pub fn codegen( )); // `${task}Resources` - let mut shared_needs_lt = false; - let mut local_needs_lt = false; // `${task}Locals` if !task.args.local_resources.is_empty() { - let (item, constructor) = local_resources_struct::codegen( - Context::SoftwareTask(name), - &mut local_needs_lt, - app, - ); + let (item, constructor) = + local_resources_struct::codegen(Context::SoftwareTask(name), app); root.push(item); @@ -53,11 +48,8 @@ pub fn codegen( } if !task.args.shared_resources.is_empty() { - let (item, constructor) = shared_resources_struct::codegen( - Context::SoftwareTask(name), - &mut shared_needs_lt, - app, - ); + let (item, constructor) = + shared_resources_struct::codegen(Context::SoftwareTask(name), app); root.push(item); @@ -69,17 +61,12 @@ pub fn codegen( let attrs = &task.attrs; let cfgs = &task.cfgs; let stmts = &task.stmts; - let context_lifetime = if shared_needs_lt || local_needs_lt { - quote!(<'static>) - } else { - quote!() - }; user_tasks.push(quote!( #(#attrs)* #(#cfgs)* #[allow(non_snake_case)] - async fn #name(#context: #name::Context #context_lifetime) { + async fn #name(#context: #name::Context<'static>) { use rtic::Mutex as _; use rtic::mutex::prelude::*; @@ -88,13 +75,7 @@ pub fn codegen( )); } - root.push(module::codegen( - Context::SoftwareTask(name), - shared_needs_lt, - local_needs_lt, - app, - analysis, - )); + root.push(module::codegen(Context::SoftwareTask(name), app, analysis)); } (mod_app, root, user_tasks) |