From f10d2b9efdce6706f9f1bb34a764e173afb2b42a Mon Sep 17 00:00:00 2001 From: Albin Hedman Date: Sun, 19 Oct 2025 13:31:39 +0200 Subject: [PATCH] Add test for spawning a local task from a different prio This ensures that there is no method on the spawning task's local spawner for spawning the local task with the other priority. --- rtic-macros/ui/spawn-local-different-exec.rs | 25 ++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 rtic-macros/ui/spawn-local-different-exec.rs diff --git a/rtic-macros/ui/spawn-local-different-exec.rs b/rtic-macros/ui/spawn-local-different-exec.rs new file mode 100644 index 00000000000..e088061a86c --- /dev/null +++ b/rtic-macros/ui/spawn-local-different-exec.rs @@ -0,0 +1,25 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock, dispatchers = [EXTI0])] +mod app { + use super::*; + + #[shared] + struct Shared {} + + #[local] + struct Local {} + + #[init] + fn init(_cx: init::Context) -> (Shared, Local) { + (Shared {}, Local {}) + } + + #[task(priority = 1, is_local_task = true)] + async fn foo(_cx: foo::Context) {} + + #[task(priority = 2)] + async fn bar(cx: bar::Context) { + cx.local_spawner.foo().ok(); + } +}