aboutsummaryrefslogtreecommitdiff
path: root/rtic-macros
diff options
context:
space:
mode:
authorEmil Fresk <emil.fresk@gmail.com>2023-05-10 14:24:32 +0200
committerEmil Fresk <emil.fresk@gmail.com>2023-05-10 16:26:52 +0200
commit67d5ade4fdbb2fb4a1c13715e4829412f4007d75 (patch)
treed724871c3173736594811daa84abbd57b71bf105 /rtic-macros
parentcfac6d1d90f13f22bde849816919e42f4ecf9531 (diff)
Fix zero prio tasks when all async tasks have default (no) arguments
Diffstat (limited to 'rtic-macros')
-rw-r--r--rtic-macros/Cargo.toml2
-rw-r--r--rtic-macros/src/syntax/ast.rs2
-rw-r--r--rtic-macros/ui/task-no-prio.rs19
-rw-r--r--rtic-macros/ui/task-no-prio.stderr5
4 files changed, 26 insertions, 2 deletions
diff --git a/rtic-macros/Cargo.toml b/rtic-macros/Cargo.toml
index 71358c0..f7e6c7b 100644
--- a/rtic-macros/Cargo.toml
+++ b/rtic-macros/Cargo.toml
@@ -22,7 +22,7 @@ name = "rtic-macros"
readme = "../README.md"
repository = "https://github.com/rtic-rs/rtic"
-version = "2.0.0-alpha.0"
+version = "2.0.0-alpha.2"
[lib]
proc-macro = true
diff --git a/rtic-macros/src/syntax/ast.rs b/rtic-macros/src/syntax/ast.rs
index d5510cb..3f4956c 100644
--- a/rtic-macros/src/syntax/ast.rs
+++ b/rtic-macros/src/syntax/ast.rs
@@ -242,7 +242,7 @@ pub struct SoftwareTaskArgs {
impl Default for SoftwareTaskArgs {
fn default() -> Self {
Self {
- priority: 1,
+ priority: 0,
local_resources: LocalResources::new(),
shared_resources: SharedResources::new(),
}
diff --git a/rtic-macros/ui/task-no-prio.rs b/rtic-macros/ui/task-no-prio.rs
new file mode 100644
index 0000000..8327777
--- /dev/null
+++ b/rtic-macros/ui/task-no-prio.rs
@@ -0,0 +1,19 @@
+#![no_main]
+
+#[rtic_macros::mock_app(device = mock)]
+mod app {
+ #[shared]
+ struct Shared {}
+
+ #[local]
+ struct Local {}
+
+ #[init]
+ fn init(_: init::Context) -> (Shared, Local) {}
+
+ #[idle]
+ fn idle(_: idle::Context) -> ! {}
+
+ #[task]
+ async fn task1(_: task1::Context) {}
+}
diff --git a/rtic-macros/ui/task-no-prio.stderr b/rtic-macros/ui/task-no-prio.stderr
new file mode 100644
index 0000000..4ff97ec
--- /dev/null
+++ b/rtic-macros/ui/task-no-prio.stderr
@@ -0,0 +1,5 @@
+error: Async task "task1" has priority 0, but `#[idle]` is defined. 0-priority async tasks are only allowed if there is no `#[idle]`.
+ --> ui/task-no-prio.rs:18:14
+ |
+18 | async fn task1(_: task1::Context) {}
+ | ^^^^^