diff options
Diffstat (limited to 'macros/ui')
120 files changed, 1028 insertions, 0 deletions
diff --git a/macros/ui/async-local-resouces.rs b/macros/ui/async-local-resouces.rs new file mode 100644 index 0000000..1ba5865 --- /dev/null +++ b/macros/ui/async-local-resouces.rs @@ -0,0 +1,28 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[shared] + struct Shared { + #[lock_free] + e: u32, + } + + #[local] + struct Local {} + + #[init] + fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {} + + // e ok + #[task(priority = 1, shared = [e])] + fn uart0(cx: uart0::Context) {} + + // e ok + #[task(priority = 1, shared = [e])] + fn uart1(cx: uart1::Context) {} + + // e not ok + #[task(priority = 1, shared = [e])] + async fn async_task(cx: async_task::Context) {} +} diff --git a/macros/ui/async-local-resouces.stderr b/macros/ui/async-local-resouces.stderr new file mode 100644 index 0000000..7ce7517 --- /dev/null +++ b/macros/ui/async-local-resouces.stderr @@ -0,0 +1,5 @@ +error: Lock free shared resource "e" is used by an async tasks, which is forbidden + --> ui/async-local-resouces.rs:26:36 + | +26 | #[task(priority = 1, shared = [e])] + | ^ diff --git a/macros/ui/async-zero-prio-tasks.rs b/macros/ui/async-zero-prio-tasks.rs new file mode 100644 index 0000000..91e0990 --- /dev/null +++ b/macros/ui/async-zero-prio-tasks.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, init::Monotonics) {} + + #[task(priority = 0)] + fn foo(_: foo::Context) {} + + #[idle] + fn idle(_: idle::Context) -> ! {} +} diff --git a/macros/ui/async-zero-prio-tasks.stderr b/macros/ui/async-zero-prio-tasks.stderr new file mode 100644 index 0000000..d617feb --- /dev/null +++ b/macros/ui/async-zero-prio-tasks.stderr @@ -0,0 +1,11 @@ +error: Software task "foo" has priority 0, but `#[idle]` is defined. 0-priority software tasks are only allowed if there is no `#[idle]`. + --> ui/async-zero-prio-tasks.rs:15:8 + | +15 | fn foo(_: foo::Context) {} + | ^^^ + +error: Software task "foo" has priority 0, but is not `async`. 0-priority software tasks must be `async`. + --> ui/async-zero-prio-tasks.rs:15:8 + | +15 | fn foo(_: foo::Context) {} + | ^^^ diff --git a/macros/ui/extern-interrupt-used.rs b/macros/ui/extern-interrupt-used.rs new file mode 100644 index 0000000..71dc50f --- /dev/null +++ b/macros/ui/extern-interrupt-used.rs @@ -0,0 +1,16 @@ +#![no_main] + +#[rtic_macros::mock_app(parse_extern_interrupt, parse_binds, device = mock, dispatchers = [EXTI0])] +mod app { + #[shared] + struct Shared {} + + #[local] + struct Local {} + + #[init] + fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {} + + #[task(binds = EXTI0)] + fn foo(_: foo::Context) {} +} diff --git a/macros/ui/extern-interrupt-used.stderr b/macros/ui/extern-interrupt-used.stderr new file mode 100644 index 0000000..f9510d7 --- /dev/null +++ b/macros/ui/extern-interrupt-used.stderr @@ -0,0 +1,5 @@ +error: dispatcher interrupts can't be used as hardware tasks + --> $DIR/extern-interrupt-used.rs:14:20 + | +14 | #[task(binds = EXTI0)] + | ^^^^^ diff --git a/macros/ui/idle-double-local.rs b/macros/ui/idle-double-local.rs new file mode 100644 index 0000000..54e67d3 --- /dev/null +++ b/macros/ui/idle-double-local.rs @@ -0,0 +1,9 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[idle(local = [A], local = [B])] + fn idle(_: idle::Context) -> ! { + loop {} + } +} diff --git a/macros/ui/idle-double-local.stderr b/macros/ui/idle-double-local.stderr new file mode 100644 index 0000000..d3ba4ec --- /dev/null +++ b/macros/ui/idle-double-local.stderr @@ -0,0 +1,5 @@ +error: argument appears more than once + --> $DIR/idle-double-local.rs:5:25 + | +5 | #[idle(local = [A], local = [B])] + | ^^^^^ diff --git a/macros/ui/idle-double-shared.rs b/macros/ui/idle-double-shared.rs new file mode 100644 index 0000000..f66cb93 --- /dev/null +++ b/macros/ui/idle-double-shared.rs @@ -0,0 +1,9 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[idle(shared = [A], shared = [B])] + fn idle(_: idle::Context) -> ! { + loop {} + } +} diff --git a/macros/ui/idle-double-shared.stderr b/macros/ui/idle-double-shared.stderr new file mode 100644 index 0000000..84864a1 --- /dev/null +++ b/macros/ui/idle-double-shared.stderr @@ -0,0 +1,5 @@ +error: argument appears more than once + --> $DIR/idle-double-shared.rs:5:26 + | +5 | #[idle(shared = [A], shared = [B])] + | ^^^^^^ diff --git a/macros/ui/idle-input.rs b/macros/ui/idle-input.rs new file mode 100644 index 0000000..c896b1c --- /dev/null +++ b/macros/ui/idle-input.rs @@ -0,0 +1,9 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[idle] + fn idle(_: idle::Context, _undef: u32) -> ! { + loop {} + } +} diff --git a/macros/ui/idle-input.stderr b/macros/ui/idle-input.stderr new file mode 100644 index 0000000..34c38fc --- /dev/null +++ b/macros/ui/idle-input.stderr @@ -0,0 +1,5 @@ +error: this `#[idle]` function must have signature `fn(idle::Context) -> !` + --> ui/idle-input.rs:6:8 + | +6 | fn idle(_: idle::Context, _undef: u32) -> ! { + | ^^^^ diff --git a/macros/ui/idle-no-context.rs b/macros/ui/idle-no-context.rs new file mode 100644 index 0000000..bab4680 --- /dev/null +++ b/macros/ui/idle-no-context.rs @@ -0,0 +1,9 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[idle] + fn idle() -> ! { + loop {} + } +} diff --git a/macros/ui/idle-no-context.stderr b/macros/ui/idle-no-context.stderr new file mode 100644 index 0000000..c9f4b3d --- /dev/null +++ b/macros/ui/idle-no-context.stderr @@ -0,0 +1,5 @@ +error: this `#[idle]` function must have signature `fn(idle::Context) -> !` + --> ui/idle-no-context.rs:6:8 + | +6 | fn idle() -> ! { + | ^^^^ diff --git a/macros/ui/idle-not-divergent.rs b/macros/ui/idle-not-divergent.rs new file mode 100644 index 0000000..d1ae8b1 --- /dev/null +++ b/macros/ui/idle-not-divergent.rs @@ -0,0 +1,7 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[idle] + fn idle(_: idle::Context) {} +} diff --git a/macros/ui/idle-not-divergent.stderr b/macros/ui/idle-not-divergent.stderr new file mode 100644 index 0000000..e318f58 --- /dev/null +++ b/macros/ui/idle-not-divergent.stderr @@ -0,0 +1,5 @@ +error: this `#[idle]` function must have signature `fn(idle::Context) -> !` + --> ui/idle-not-divergent.rs:6:8 + | +6 | fn idle(_: idle::Context) {} + | ^^^^ diff --git a/macros/ui/idle-output.rs b/macros/ui/idle-output.rs new file mode 100644 index 0000000..1662157 --- /dev/null +++ b/macros/ui/idle-output.rs @@ -0,0 +1,9 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[idle] + fn idle(_: idle::Context) -> u32 { + 0 + } +} diff --git a/macros/ui/idle-output.stderr b/macros/ui/idle-output.stderr new file mode 100644 index 0000000..7070e25 --- /dev/null +++ b/macros/ui/idle-output.stderr @@ -0,0 +1,5 @@ +error: this `#[idle]` function must have signature `fn(idle::Context) -> !` + --> ui/idle-output.rs:6:8 + | +6 | fn idle(_: idle::Context) -> u32 { + | ^^^^ diff --git a/macros/ui/idle-pub.rs b/macros/ui/idle-pub.rs new file mode 100644 index 0000000..0d8dd01 --- /dev/null +++ b/macros/ui/idle-pub.rs @@ -0,0 +1,9 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[idle] + pub fn idle(_: idle::Context) -> ! { + loop {} + } +} diff --git a/macros/ui/idle-pub.stderr b/macros/ui/idle-pub.stderr new file mode 100644 index 0000000..aa46ac3 --- /dev/null +++ b/macros/ui/idle-pub.stderr @@ -0,0 +1,5 @@ +error: this `#[idle]` function must have signature `fn(idle::Context) -> !` + --> ui/idle-pub.rs:6:12 + | +6 | pub fn idle(_: idle::Context) -> ! { + | ^^^^ diff --git a/macros/ui/idle-unsafe.rs b/macros/ui/idle-unsafe.rs new file mode 100644 index 0000000..3422ef2 --- /dev/null +++ b/macros/ui/idle-unsafe.rs @@ -0,0 +1,9 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[idle] + unsafe fn idle(_: idle::Context) -> ! { + loop {} + } +} diff --git a/macros/ui/idle-unsafe.stderr b/macros/ui/idle-unsafe.stderr new file mode 100644 index 0000000..a416800 --- /dev/null +++ b/macros/ui/idle-unsafe.stderr @@ -0,0 +1,5 @@ +error: this `#[idle]` function must have signature `fn(idle::Context) -> !` + --> ui/idle-unsafe.rs:6:15 + | +6 | unsafe fn idle(_: idle::Context) -> ! { + | ^^^^ diff --git a/macros/ui/init-divergent.rs b/macros/ui/init-divergent.rs new file mode 100644 index 0000000..5e4e96a --- /dev/null +++ b/macros/ui/init-divergent.rs @@ -0,0 +1,13 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[shared] + struct Shared {} + + #[local] + struct Local {} + + #[init] + fn init(_: init::Context) -> ! {} +} diff --git a/macros/ui/init-divergent.stderr b/macros/ui/init-divergent.stderr new file mode 100644 index 0000000..2d5cc39 --- /dev/null +++ b/macros/ui/init-divergent.stderr @@ -0,0 +1,5 @@ +error: the `#[init]` function must have signature `fn(init::Context) -> (Shared resources struct, Local resources struct, init::Monotonics)` + --> $DIR/init-divergent.rs:12:8 + | +12 | fn init(_: init::Context) -> ! {} + | ^^^^ diff --git a/macros/ui/init-double-local.rs b/macros/ui/init-double-local.rs new file mode 100644 index 0000000..5f6d7ac --- /dev/null +++ b/macros/ui/init-double-local.rs @@ -0,0 +1,7 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[init(local = [A], local = [B])] + fn init(_: init::Context) {} +} diff --git a/macros/ui/init-double-local.stderr b/macros/ui/init-double-local.stderr new file mode 100644 index 0000000..5ffd2c1 --- /dev/null +++ b/macros/ui/init-double-local.stderr @@ -0,0 +1,5 @@ +error: argument appears more than once + --> $DIR/init-double-local.rs:5:25 + | +5 | #[init(local = [A], local = [B])] + | ^^^^^ diff --git a/macros/ui/init-double-shared.rs b/macros/ui/init-double-shared.rs new file mode 100644 index 0000000..4503c87 --- /dev/null +++ b/macros/ui/init-double-shared.rs @@ -0,0 +1,7 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[init(shared = [A], shared = [B])] + fn init(_: init::Context) {} +} diff --git a/macros/ui/init-double-shared.stderr b/macros/ui/init-double-shared.stderr new file mode 100644 index 0000000..b6b1f6d --- /dev/null +++ b/macros/ui/init-double-shared.stderr @@ -0,0 +1,5 @@ +error: unexpected argument + --> $DIR/init-double-shared.rs:5:12 + | +5 | #[init(shared = [A], shared = [B])] + | ^^^^^^ diff --git a/macros/ui/init-input.rs b/macros/ui/init-input.rs new file mode 100644 index 0000000..ac2a1bd --- /dev/null +++ b/macros/ui/init-input.rs @@ -0,0 +1,13 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[shared] + struct Shared {} + + #[local] + struct Local {} + + #[init] + fn init(_: init::Context, _undef: u32) -> (Shared, Local, init::Monotonics) {} +} diff --git a/macros/ui/init-input.stderr b/macros/ui/init-input.stderr new file mode 100644 index 0000000..983c469 --- /dev/null +++ b/macros/ui/init-input.stderr @@ -0,0 +1,5 @@ +error: the `#[init]` function must have signature `fn(init::Context) -> (Shared resources struct, Local resources struct, init::Monotonics)` + --> $DIR/init-input.rs:12:8 + | +12 | fn init(_: init::Context, _undef: u32) -> (Shared, Local, init::Monotonics) {} + | ^^^^ diff --git a/macros/ui/init-no-context.rs b/macros/ui/init-no-context.rs new file mode 100644 index 0000000..a74093a --- /dev/null +++ b/macros/ui/init-no-context.rs @@ -0,0 +1,13 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[shared] + struct Shared {} + + #[local] + struct Local {} + + #[init] + fn init() -> (Shared, Local, init::Monotonics) {} +} diff --git a/macros/ui/init-no-context.stderr b/macros/ui/init-no-context.stderr new file mode 100644 index 0000000..742e2ab --- /dev/null +++ b/macros/ui/init-no-context.stderr @@ -0,0 +1,5 @@ +error: the `#[init]` function must have signature `fn(init::Context) -> (Shared resources struct, Local resources struct, init::Monotonics)` + --> $DIR/init-no-context.rs:12:8 + | +12 | fn init() -> (Shared, Local, init::Monotonics) {} + | ^^^^ diff --git a/macros/ui/init-output.rs b/macros/ui/init-output.rs new file mode 100644 index 0000000..7057c95 --- /dev/null +++ b/macros/ui/init-output.rs @@ -0,0 +1,9 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[init] + fn init(_: init::Context) -> u32 { + 0 + } +} diff --git a/macros/ui/init-output.stderr b/macros/ui/init-output.stderr new file mode 100644 index 0000000..03e982c --- /dev/null +++ b/macros/ui/init-output.stderr @@ -0,0 +1,5 @@ +error: the `#[init]` function must have signature `fn(init::Context) -> (Shared resources struct, Local resources struct, init::Monotonics)` + --> $DIR/init-output.rs:6:8 + | +6 | fn init(_: init::Context) -> u32 { + | ^^^^ diff --git a/macros/ui/init-pub.rs b/macros/ui/init-pub.rs new file mode 100644 index 0000000..43375e4 --- /dev/null +++ b/macros/ui/init-pub.rs @@ -0,0 +1,13 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[shared] + struct Shared {} + + #[local] + struct Local {} + + #[init] + pub fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {} +} diff --git a/macros/ui/init-pub.stderr b/macros/ui/init-pub.stderr new file mode 100644 index 0000000..eb68e1e --- /dev/null +++ b/macros/ui/init-pub.stderr @@ -0,0 +1,5 @@ +error: the `#[init]` function must have signature `fn(init::Context) -> (Shared resources struct, Local resources struct, init::Monotonics)` + --> $DIR/init-pub.rs:12:12 + | +12 | pub fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {} + | ^^^^ diff --git a/macros/ui/init-unsafe.rs b/macros/ui/init-unsafe.rs new file mode 100644 index 0000000..b5d391d --- /dev/null +++ b/macros/ui/init-unsafe.rs @@ -0,0 +1,7 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[init] + unsafe fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {} +} diff --git a/macros/ui/init-unsafe.stderr b/macros/ui/init-unsafe.stderr new file mode 100644 index 0000000..2a48533 --- /dev/null +++ b/macros/ui/init-unsafe.stderr @@ -0,0 +1,5 @@ +error: the `#[init]` function must have signature `fn(init::Context) -> (Shared resources struct, Local resources struct, init::Monotonics)` + --> $DIR/init-unsafe.rs:6:15 + | +6 | unsafe fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {} + | ^^^^ diff --git a/macros/ui/interrupt-double.rs b/macros/ui/interrupt-double.rs new file mode 100644 index 0000000..1133c5c --- /dev/null +++ b/macros/ui/interrupt-double.rs @@ -0,0 +1,10 @@ +#![no_main] + +#[rtic_macros::mock_app(parse_binds, device = mock)] +mod app { + #[task(binds = UART0)] + fn foo(_: foo::Context) {} + + #[task(binds = UART0)] + fn bar(_: bar::Context) {} +} diff --git a/macros/ui/interrupt-double.stderr b/macros/ui/interrupt-double.stderr new file mode 100644 index 0000000..62b979b --- /dev/null +++ b/macros/ui/interrupt-double.stderr @@ -0,0 +1,5 @@ +error: this interrupt is already bound + --> $DIR/interrupt-double.rs:8:20 + | +8 | #[task(binds = UART0)] + | ^^^^^ diff --git a/macros/ui/local-collision-2.rs b/macros/ui/local-collision-2.rs new file mode 100644 index 0000000..7bd092c --- /dev/null +++ b/macros/ui/local-collision-2.rs @@ -0,0 +1,21 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[shared] + struct Shared {} + + #[local] + struct Local { + a: u32, + } + + fn bar(_: bar::Context) {} + + #[task(local = [a: u8 = 3])] + fn bar(_: bar::Context) {} + + #[init(local = [a: u16 = 2])] + fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {} +} + diff --git a/macros/ui/local-collision-2.stderr b/macros/ui/local-collision-2.stderr new file mode 100644 index 0000000..1e4c5fa --- /dev/null +++ b/macros/ui/local-collision-2.stderr @@ -0,0 +1,17 @@ +error: Local resource "a" is used by multiple tasks or collides with multiple definitions + --> $DIR/local-collision-2.rs:10:9 + | +10 | a: u32, + | ^ + +error: Local resource "a" is used by multiple tasks or collides with multiple definitions + --> $DIR/local-collision-2.rs:18:21 + | +18 | #[init(local = [a: u16 = 2])] + | ^ + +error: Local resource "a" is used by multiple tasks or collides with multiple definitions + --> $DIR/local-collision-2.rs:15:21 + | +15 | #[task(local = [a: u8 = 3])] + | ^ diff --git a/macros/ui/local-collision.rs b/macros/ui/local-collision.rs new file mode 100644 index 0000000..7dbe976 --- /dev/null +++ b/macros/ui/local-collision.rs @@ -0,0 +1,21 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[shared] + struct Shared {} + + #[local] + struct Local { + a: u32, + } + + #[task(local = [a])] + fn foo(_: foo::Context) {} + + #[task(local = [a: u8 = 3])] + fn bar(_: bar::Context) {} + + #[init] + fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {} +} diff --git a/macros/ui/local-collision.stderr b/macros/ui/local-collision.stderr new file mode 100644 index 0000000..1ba1da9 --- /dev/null +++ b/macros/ui/local-collision.stderr @@ -0,0 +1,11 @@ +error: Local resource "a" is used by multiple tasks or collides with multiple definitions + --> $DIR/local-collision.rs:10:9 + | +10 | a: u32, + | ^ + +error: Local resource "a" is used by multiple tasks or collides with multiple definitions + --> $DIR/local-collision.rs:16:21 + | +16 | #[task(local = [a: u8 = 3])] + | ^ diff --git a/macros/ui/local-malformed-1.rs b/macros/ui/local-malformed-1.rs new file mode 100644 index 0000000..7efcd9c --- /dev/null +++ b/macros/ui/local-malformed-1.rs @@ -0,0 +1,16 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[shared] + struct Shared {} + + #[local] + struct Local {} + + #[task(local = [a:])] + fn foo(_: foo::Context) {} + + #[init] + fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {} +} diff --git a/macros/ui/local-malformed-1.stderr b/macros/ui/local-malformed-1.stderr new file mode 100644 index 0000000..d15c324 --- /dev/null +++ b/macros/ui/local-malformed-1.stderr @@ -0,0 +1,5 @@ +error: unexpected end of input, expected one of: `for`, parentheses, `fn`, `unsafe`, `extern`, identifier, `::`, `<`, square brackets, `*`, `&`, `!`, `impl`, `_`, lifetime + --> ui/local-malformed-1.rs:11:23 + | +11 | #[task(local = [a:])] + | ^ diff --git a/macros/ui/local-malformed-2.rs b/macros/ui/local-malformed-2.rs new file mode 100644 index 0000000..ce5f891 --- /dev/null +++ b/macros/ui/local-malformed-2.rs @@ -0,0 +1,16 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[shared] + struct Shared {} + + #[local] + struct Local {} + + #[task(local = [a: u32])] + fn foo(_: foo::Context) {} + + #[init] + fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {} +} diff --git a/macros/ui/local-malformed-2.stderr b/macros/ui/local-malformed-2.stderr new file mode 100644 index 0000000..ceb0405 --- /dev/null +++ b/macros/ui/local-malformed-2.stderr @@ -0,0 +1,5 @@ +error: malformed, expected 'IDENT: TYPE = EXPR' + --> ui/local-malformed-2.rs:11:21 + | +11 | #[task(local = [a: u32])] + | ^ diff --git a/macros/ui/local-malformed-3.rs b/macros/ui/local-malformed-3.rs new file mode 100644 index 0000000..935dc2c --- /dev/null +++ b/macros/ui/local-malformed-3.rs @@ -0,0 +1,16 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[shared] + struct Shared {} + + #[local] + struct Local {} + + #[task(local = [a: u32 =])] + fn foo(_: foo::Context) {} + + #[init] + fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {} +} diff --git a/macros/ui/local-malformed-3.stderr b/macros/ui/local-malformed-3.stderr new file mode 100644 index 0000000..61af4f3 --- /dev/null +++ b/macros/ui/local-malformed-3.stderr @@ -0,0 +1,5 @@ +error: unexpected end of input, expected expression + --> ui/local-malformed-3.rs:11:29 + | +11 | #[task(local = [a: u32 =])] + | ^ diff --git a/macros/ui/local-malformed-4.rs b/macros/ui/local-malformed-4.rs new file mode 100644 index 0000000..49661b5 --- /dev/null +++ b/macros/ui/local-malformed-4.rs @@ -0,0 +1,16 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[shared] + struct Shared {} + + #[local] + struct Local {} + + #[task(local = [a = u32])] + fn foo(_: foo::Context) {} + + #[init] + fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {} +} diff --git a/macros/ui/local-malformed-4.stderr b/macros/ui/local-malformed-4.stderr new file mode 100644 index 0000000..0f7d9e7 --- /dev/null +++ b/macros/ui/local-malformed-4.stderr @@ -0,0 +1,5 @@ +error: malformed, expected a type + --> ui/local-malformed-4.rs:11:21 + | +11 | #[task(local = [a = u32])] + | ^ diff --git a/macros/ui/local-not-declared.rs b/macros/ui/local-not-declared.rs new file mode 100644 index 0000000..5a38b3d --- /dev/null +++ b/macros/ui/local-not-declared.rs @@ -0,0 +1,16 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[shared] + struct Shared {} + + #[local] + struct Local {} + + #[task(local = [A])] + fn foo(_: foo::Context) {} + + #[init] + fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {} +} diff --git a/macros/ui/local-not-declared.stderr b/macros/ui/local-not-declared.stderr new file mode 100644 index 0000000..540b4bb --- /dev/null +++ b/macros/ui/local-not-declared.stderr @@ -0,0 +1,5 @@ +error: this local resource has NOT been declared + --> $DIR/local-not-declared.rs:11:21 + | +11 | #[task(local = [A])] + | ^ diff --git a/macros/ui/local-pub.rs b/macros/ui/local-pub.rs new file mode 100644 index 0000000..8c51754 --- /dev/null +++ b/macros/ui/local-pub.rs @@ -0,0 +1,9 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[local] + struct Local { + pub x: u32, + } +} diff --git a/macros/ui/local-pub.stderr b/macros/ui/local-pub.stderr new file mode 100644 index 0000000..041bc59 --- /dev/null +++ b/macros/ui/local-pub.stderr @@ -0,0 +1,5 @@ +error: this field must have inherited / private visibility + --> $DIR/local-pub.rs:7:13 + | +7 | pub x: u32, + | ^ diff --git a/macros/ui/local-shared-attribute.rs b/macros/ui/local-shared-attribute.rs new file mode 100644 index 0000000..1ccce4a --- /dev/null +++ b/macros/ui/local-shared-attribute.rs @@ -0,0 +1,14 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[task(local = [ + #[test] + a: u32 = 0, // Ok + #[test] + b, // Error + ])] + fn foo(_: foo::Context) { + + } +} diff --git a/macros/ui/local-shared-attribute.stderr b/macros/ui/local-shared-attribute.stderr new file mode 100644 index 0000000..5c15fb5 --- /dev/null +++ b/macros/ui/local-shared-attribute.stderr @@ -0,0 +1,5 @@ +error: attributes are not supported here + --> $DIR/local-shared-attribute.rs:8:9 + | +8 | #[test] + | ^ diff --git a/macros/ui/local-shared.rs b/macros/ui/local-shared.rs new file mode 100644 index 0000000..f6fb491 --- /dev/null +++ b/macros/ui/local-shared.rs @@ -0,0 +1,28 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[shared] + struct Shared {} + + #[local] + struct Local { + l1: u32, + l2: u32, + } + + #[init] + fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {} + + // l2 ok + #[idle(local = [l2])] + fn idle(cx: idle::Context) -> ! {} + + // l1 rejected (not local) + #[task(priority = 1, local = [l1])] + fn uart0(cx: uart0::Context) {} + + // l1 rejected (not lock_free) + #[task(priority = 2, local = [l1])] + fn uart1(cx: uart1::Context) {} +} diff --git a/macros/ui/local-shared.stderr b/macros/ui/local-shared.stderr new file mode 100644 index 0000000..0d22db3 --- /dev/null +++ b/macros/ui/local-shared.stderr @@ -0,0 +1,11 @@ +error: Local resource "l1" is used by multiple tasks or collides with multiple definitions + --> $DIR/local-shared.rs:22:35 + | +22 | #[task(priority = 1, local = [l1])] + | ^^ + +error: Local resource "l1" is used by multiple tasks or collides with multiple definitions + --> $DIR/local-shared.rs:26:35 + | +26 | #[task(priority = 2, local = [l1])] + | ^^ diff --git a/macros/ui/monotonic-binds-collision-task.rs b/macros/ui/monotonic-binds-collision-task.rs new file mode 100644 index 0000000..57c59c1 --- /dev/null +++ b/macros/ui/monotonic-binds-collision-task.rs @@ -0,0 +1,10 @@ +#![no_main] + +#[rtic_macros::mock_app(parse_extern_interrupt, parse_binds, device = mock)] +mod app { + #[monotonic(binds = Tim1)] + type Fast1 = hal::Tim1Monotonic; + + #[task(binds = Tim1)] + fn foo(_: foo::Context) {} +} diff --git a/macros/ui/monotonic-binds-collision-task.stderr b/macros/ui/monotonic-binds-collision-task.stderr new file mode 100644 index 0000000..8f84986 --- /dev/null +++ b/macros/ui/monotonic-binds-collision-task.stderr @@ -0,0 +1,5 @@ +error: this interrupt is already bound + --> $DIR/monotonic-binds-collision-task.rs:8:20 + | +8 | #[task(binds = Tim1)] + | ^^^^ diff --git a/macros/ui/monotonic-binds-collision.rs b/macros/ui/monotonic-binds-collision.rs new file mode 100644 index 0000000..4e54814 --- /dev/null +++ b/macros/ui/monotonic-binds-collision.rs @@ -0,0 +1,10 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[monotonic(binds = Tim1)] + type Fast1 = hal::Tim1Monotonic; + + #[monotonic(binds = Tim1)] + type Fast2 = hal::Tim2Monotonic; +} diff --git a/macros/ui/monotonic-binds-collision.stderr b/macros/ui/monotonic-binds-collision.stderr new file mode 100644 index 0000000..62b764b --- /dev/null +++ b/macros/ui/monotonic-binds-collision.stderr @@ -0,0 +1,5 @@ +error: this interrupt is already bound + --> $DIR/monotonic-binds-collision.rs:8:25 + | +8 | #[monotonic(binds = Tim1)] + | ^^^^ diff --git a/macros/ui/monotonic-double-binds.rs b/macros/ui/monotonic-double-binds.rs new file mode 100644 index 0000000..1705dc4 --- /dev/null +++ b/macros/ui/monotonic-double-binds.rs @@ -0,0 +1,7 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[monotonic(binds = Tim1, binds = Tim2)] + type Fast = hal::Tim1Monotonic; +} diff --git a/macros/ui/monotonic-double-binds.stderr b/macros/ui/monotonic-double-binds.stderr new file mode 100644 index 0000000..c7313df --- /dev/null +++ b/macros/ui/monotonic-double-binds.stderr @@ -0,0 +1,5 @@ +error: argument appears more than once + --> $DIR/monotonic-double-binds.rs:5:31 + | +5 | #[monotonic(binds = Tim1, binds = Tim2)] + | ^^^^^ diff --git a/macros/ui/monotonic-double-default.rs b/macros/ui/monotonic-double-default.rs new file mode 100644 index 0000000..dc4eac6 --- /dev/null +++ b/macros/ui/monotonic-double-default.rs @@ -0,0 +1,7 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[monotonic(binds = Tim1, default = true, default = false)] + type Fast = hal::Tim1Monotonic; +} diff --git a/macros/ui/monotonic-double-default.stderr b/macros/ui/monotonic-double-default.stderr new file mode 100644 index 0000000..9819d04 --- /dev/null +++ b/macros/ui/monotonic-double-default.stderr @@ -0,0 +1,5 @@ +error: argument appears more than once + --> $DIR/monotonic-double-default.rs:5:47 + | +5 | #[monotonic(binds = Tim1, default = true, default = false)] + | ^^^^^^^ diff --git a/macros/ui/monotonic-double-prio.rs b/macros/ui/monotonic-double-prio.rs new file mode 100644 index 0000000..4330ddb --- /dev/null +++ b/macros/ui/monotonic-double-prio.rs @@ -0,0 +1,7 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[monotonic(binds = Tim1, priority = 1, priority = 2)] + type Fast = hal::Tim1Monotonic; +} diff --git a/macros/ui/monotonic-double-prio.stderr b/macros/ui/monotonic-double-prio.stderr new file mode 100644 index 0000000..fa888e2 --- /dev/null +++ b/macros/ui/monotonic-double-prio.stderr @@ -0,0 +1,5 @@ +error: argument appears more than once + --> $DIR/monotonic-double-prio.rs:5:45 + | +5 | #[monotonic(binds = Tim1, priority = 1, priority = 2)] + | ^^^^^^^^ diff --git a/macros/ui/monotonic-double.rs b/macros/ui/monotonic-double.rs new file mode 100644 index 0000000..3c43fae --- /dev/null +++ b/macros/ui/monotonic-double.rs @@ -0,0 +1,10 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[monotonic(binds = Tim1)] + type Fast = hal::Tim1Monotonic; + + #[monotonic(binds = Tim1)] + type Fast = hal::Tim1Monotonic; +} diff --git a/macros/ui/monotonic-double.stderr b/macros/ui/monotonic-double.stderr new file mode 100644 index 0000000..9fab84c --- /dev/null +++ b/macros/ui/monotonic-double.stderr @@ -0,0 +1,5 @@ +error: `#[monotonic(...)]` on a specific type must appear at most once + --> ui/monotonic-double.rs:9:10 + | +9 | type Fast = hal::Tim1Monotonic; + | ^^^^ diff --git a/macros/ui/monotonic-name-collision.rs b/macros/ui/monotonic-name-collision.rs new file mode 100644 index 0000000..d8d4431 --- /dev/null +++ b/macros/ui/monotonic-name-collision.rs @@ -0,0 +1,10 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[monotonic(binds = Tim1)] + type Fast1 = hal::Tim1Monotonic; + + #[monotonic(binds = Tim2)] + type Fast1 = hal::Tim2Monotonic; +} diff --git a/macros/ui/monotonic-name-collision.stderr b/macros/ui/monotonic-name-collision.stderr new file mode 100644 index 0000000..6557ee5 --- /dev/null +++ b/macros/ui/monotonic-name-collision.stderr @@ -0,0 +1,5 @@ +error: `#[monotonic(...)]` on a specific type must appear at most once + --> ui/monotonic-name-collision.rs:9:10 + | +9 | type Fast1 = hal::Tim2Monotonic; + | ^^^^^ diff --git a/macros/ui/monotonic-no-binds.rs b/macros/ui/monotonic-no-binds.rs new file mode 100644 index 0000000..462d73e --- /dev/null +++ b/macros/ui/monotonic-no-binds.rs @@ -0,0 +1,7 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[monotonic()] + type Fast = hal::Tim1Monotonic; +} diff --git a/macros/ui/monotonic-no-binds.stderr b/macros/ui/monotonic-no-binds.stderr new file mode 100644 index 0000000..0ef7b60 --- /dev/null +++ b/macros/ui/monotonic-no-binds.stderr @@ -0,0 +1,5 @@ +error: `binds = ...` is missing + --> $DIR/monotonic-no-binds.rs:5:17 + | +5 | #[monotonic()] + | ^ diff --git a/macros/ui/monotonic-no-paran.rs b/macros/ui/monotonic-no-paran.rs new file mode 100644 index 0000000..e294bc8 --- /dev/null +++ b/macros/ui/monotonic-no-paran.rs @@ -0,0 +1,8 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[monotonic] + type Fast = hal::Tim1Monotonic; +} + diff --git a/macros/ui/monotonic-no-paran.stderr b/macros/ui/monotonic-no-paran.stderr new file mode 100644 index 0000000..c2b32c5 --- /dev/null +++ b/macros/ui/monotonic-no-paran.stderr @@ -0,0 +1,5 @@ +error: expected opening ( in #[monotonic( ... )] + --> ui/monotonic-no-paran.rs:5:7 + | +5 | #[monotonic] + | ^^^^^^^^^ diff --git a/macros/ui/monotonic-timer-collision.rs b/macros/ui/monotonic-timer-collision.rs new file mode 100644 index 0000000..5663ad7 --- /dev/null +++ b/macros/ui/monotonic-timer-collision.rs @@ -0,0 +1,10 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[monotonic(binds = Tim1)] + type Fast1 = hal::Tim1Monotonic; + + #[monotonic(binds = Tim2)] + type Fast2 = hal::Tim1Monotonic; +} diff --git a/macros/ui/monotonic-timer-collision.stderr b/macros/ui/monotonic-timer-collision.stderr new file mode 100644 index 0000000..239b96b --- /dev/null +++ b/macros/ui/monotonic-timer-collision.stderr @@ -0,0 +1,5 @@ +error: this type is already used by another monotonic + --> $DIR/monotonic-timer-collision.rs:9:18 + | +9 | type Fast2 = hal::Tim1Monotonic; + | ^^^ diff --git a/macros/ui/monotonic-with-attrs.rs b/macros/ui/monotonic-with-attrs.rs new file mode 100644 index 0000000..7c63fbb --- /dev/null +++ b/macros/ui/monotonic-with-attrs.rs @@ -0,0 +1,8 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[no_mangle] + #[monotonic(binds = Tim1)] + type Fast = hal::Tim1Monotonic; +} diff --git a/macros/ui/monotonic-with-attrs.stderr b/macros/ui/monotonic-with-attrs.stderr new file mode 100644 index 0000000..62655d8 --- /dev/null +++ b/macros/ui/monotonic-with-attrs.stderr @@ -0,0 +1,5 @@ +error: Monotonic does not support attributes other than `#[cfg]` + --> $DIR/monotonic-with-attrs.rs:5:7 + | +5 | #[no_mangle] + | ^^^^^^^^^ diff --git a/macros/ui/pub-local.stderr b/macros/ui/pub-local.stderr new file mode 100644 index 0000000..dee818c --- /dev/null +++ b/macros/ui/pub-local.stderr @@ -0,0 +1,5 @@ +error: this field must have inherited / private visibility + --> $DIR/pub-local.rs:7:13 + | +7 | pub x: u32, + | ^ diff --git a/macros/ui/pub-shared.stderr b/macros/ui/pub-shared.stderr new file mode 100644 index 0000000..0fdb1ff --- /dev/null +++ b/macros/ui/pub-shared.stderr @@ -0,0 +1,5 @@ +error: this field must have inherited / private visibility + --> $DIR/pub-shared.rs:7:13 + | +7 | pub x: u32, + | ^ diff --git a/macros/ui/shared-lock-free.rs b/macros/ui/shared-lock-free.rs new file mode 100644 index 0000000..c7f8a16 --- /dev/null +++ b/macros/ui/shared-lock-free.rs @@ -0,0 +1,38 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[shared] + struct Shared { + // An exclusive, early resource + #[lock_free] + e1: u32, + + // An exclusive, late resource + #[lock_free] + e2: u32, + } + + #[local] + struct Local {} + + #[init] + fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {} + + // e2 ok + #[idle(shared = [e2])] + fn idle(cx: idle::Context) -> ! { + debug::exit(debug::EXIT_SUCCESS); + loop {} + } + + // e1 rejected (not lock_free) + #[task(priority = 1, shared = [e1])] + fn uart0(cx: uart0::Context) { + *cx.resources.e1 += 10; + } + + // e1 rejected (not lock_free) + #[task(priority = 2, shared = [e1])] + fn uart1(cx: uart1::Context) {} +} diff --git a/macros/ui/shared-lock-free.stderr b/macros/ui/shared-lock-free.stderr new file mode 100644 index 0000000..c6820e8 --- /dev/null +++ b/macros/ui/shared-lock-free.stderr @@ -0,0 +1,17 @@ +error: Lock free shared resource "e1" is used by tasks at different priorities + --> $DIR/shared-lock-free.rs:9:9 + | +9 | e1: u32, + | ^^ + +error: Shared resource "e1" is declared lock free but used by tasks at different priorities + --> $DIR/shared-lock-free.rs:30:36 + | +30 | #[task(priority = 1, shared = [e1])] + | ^^ + +error: Shared resource "e1" is declared lock free but used by tasks at different priorities + --> $DIR/shared-lock-free.rs:36:36 + | +36 | #[task(priority = 2, shared = [e1])] + | ^^ diff --git a/macros/ui/shared-not-declared.rs b/macros/ui/shared-not-declared.rs new file mode 100644 index 0000000..aca4178 --- /dev/null +++ b/macros/ui/shared-not-declared.rs @@ -0,0 +1,16 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[shared] + struct Shared {} + + #[local] + struct Local {} + + #[task(shared = [A])] + fn foo(_: foo::Context) {} + + #[init] + fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {} +} diff --git a/macros/ui/shared-not-declared.stderr b/macros/ui/shared-not-declared.stderr new file mode 100644 index 0000000..c174251 --- /dev/null +++ b/macros/ui/shared-not-declared.stderr @@ -0,0 +1,5 @@ +error: this shared resource has NOT been declared + --> $DIR/shared-not-declared.rs:11:22 + | +11 | #[task(shared = [A])] + | ^ diff --git a/macros/ui/shared-pub.rs b/macros/ui/shared-pub.rs new file mode 100644 index 0000000..10351fd --- /dev/null +++ b/macros/ui/shared-pub.rs @@ -0,0 +1,9 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[shared] + struct Shared { + pub x: u32, + } +} diff --git a/macros/ui/shared-pub.stderr b/macros/ui/shared-pub.stderr new file mode 100644 index 0000000..8f761c6 --- /dev/null +++ b/macros/ui/shared-pub.stderr @@ -0,0 +1,5 @@ +error: this field must have inherited / private visibility + --> $DIR/shared-pub.rs:7:13 + | +7 | pub x: u32, + | ^ diff --git a/macros/ui/task-bind.rs b/macros/ui/task-bind.rs new file mode 100644 index 0000000..de60524 --- /dev/null +++ b/macros/ui/task-bind.rs @@ -0,0 +1,7 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[task(binds = UART0)] + fn foo(_: foo::Context) {} +} diff --git a/macros/ui/task-bind.stderr b/macros/ui/task-bind.stderr new file mode 100644 index 0000000..60cfdc8 --- /dev/null +++ b/macros/ui/task-bind.stderr @@ -0,0 +1,5 @@ +error: Unexpected bind in task argument. Binds are only parsed if Settings::parse_binds is set. + --> $DIR/task-bind.rs:5:12 + | +5 | #[task(binds = UART0)] + | ^^^^^ diff --git a/macros/ui/task-divergent.rs b/macros/ui/task-divergent.rs new file mode 100644 index 0000000..5a471f3 --- /dev/null +++ b/macros/ui/task-divergent.rs @@ -0,0 +1,9 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[task] + fn foo(_: foo::Context) -> ! { + loop {} + } +} diff --git a/macros/ui/task-divergent.stderr b/macros/ui/task-divergent.stderr new file mode 100644 index 0000000..b25ca5d --- /dev/null +++ b/macros/ui/task-divergent.stderr @@ -0,0 +1,5 @@ +error: this task handler must have type signature `(async) fn(foo::Context, ..)` + --> ui/task-divergent.rs:6:8 + | +6 | fn foo(_: foo::Context) -> ! { + | ^^^ diff --git a/macros/ui/task-double-capacity.rs b/macros/ui/task-double-capacity.rs new file mode 100644 index 0000000..806d973 --- /dev/null +++ b/macros/ui/task-double-capacity.rs @@ -0,0 +1,7 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[task(capacity = 1, capacity = 2)] + fn foo(_: foo::Context) {} +} diff --git a/macros/ui/task-double-capacity.stderr b/macros/ui/task-double-capacity.stderr new file mode 100644 index 0000000..f73bca5 --- /dev/null +++ b/macros/ui/task-double-capacity.stderr @@ -0,0 +1,5 @@ +error: argument appears more than once + --> $DIR/task-double-capacity.rs:5:26 + | +5 | #[task(capacity = 1, capacity = 2)] + | ^^^^^^^^ diff --git a/macros/ui/task-double-local.rs b/macros/ui/task-double-local.rs new file mode 100644 index 0000000..2e465d7 --- /dev/null +++ b/macros/ui/task-double-local.rs @@ -0,0 +1,7 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[task(local = [A], local = [B])] + fn foo(_: foo::Context) {} +} diff --git a/macros/ui/task-double-local.stderr b/macros/ui/task-double-local.stderr new file mode 100644 index 0000000..654ed33 --- /dev/null +++ b/macros/ui/task-double-local.stderr @@ -0,0 +1,5 @@ +error: argument appears more than once + --> $DIR/task-double-local.rs:5:25 + | +5 | #[task(local = [A], local = [B])] + | ^^^^^ diff --git a/macros/ui/task-double-priority.rs b/macros/ui/task-double-priority.rs new file mode 100644 index 0000000..0a2ef0d --- /dev/null +++ b/macros/ui/task-double-priority.rs @@ -0,0 +1,7 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[task(priority = 1, priority = 2)] + fn foo(_: foo::Context) {} +} diff --git a/macros/ui/task-double-priority.stderr b/macros/ui/task-double-priority.stderr new file mode 100644 index 0000000..3d06dc6 --- /dev/null +++ b/macros/ui/task-double-priority.stderr @@ -0,0 +1,5 @@ +error: argument appears more than once + --> $DIR/task-double-priority.rs:5:26 + | +5 | #[task(priority = 1, priority = 2)] + | ^^^^^^^^ diff --git a/macros/ui/task-double-shared.rs b/macros/ui/task-double-shared.rs new file mode 100644 index 0000000..3b4d411 --- /dev/null +++ b/macros/ui/task-double-shared.rs @@ -0,0 +1,7 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[task(shared = [A], shared = [B])] + fn foo(_: foo::Context) {} +} diff --git a/macros/ui/task-double-shared.stderr b/macros/ui/task-double-shared.stderr new file mode 100644 index 0000000..6952f06 --- /dev/null +++ b/macros/ui/task-double-shared.stderr @@ -0,0 +1,5 @@ +error: argument appears more than once + --> $DIR/task-double-shared.rs:5:26 + | +5 | #[task(shared = [A], shared = [B])] + | ^^^^^^ diff --git a/macros/ui/task-idle.rs b/macros/ui/task-idle.rs new file mode 100644 index 0000000..3be6e28 --- /dev/null +++ b/macros/ui/task-idle.rs @@ -0,0 +1,13 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[idle] + fn foo(_: foo::Context) -> ! { + loop {} + } + + // name collides with `#[idle]` function + #[task] + fn foo(_: foo::Context) {} +} diff --git a/macros/ui/task-idle.stderr b/macros/ui/task-idle.stderr new file mode 100644 index 0000000..ba4fc94 --- /dev/null +++ b/macros/ui/task-idle.stderr @@ -0,0 +1,5 @@ +error: this identifier has already been used + --> $DIR/task-idle.rs:12:8 + | +12 | fn foo(_: foo::Context) {} + | ^^^ diff --git a/macros/ui/task-init.rs b/macros/ui/task-init.rs new file mode 100644 index 0000000..bab3805 --- /dev/null +++ b/macros/ui/task-init.rs @@ -0,0 +1,17 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[shared] + struct Shared {} + + #[local] + struct Local {} + + #[init] + fn foo(_: foo::Context) -> (Shared, Local, foo::Monotonics) {} + + // name collides with `#[idle]` function + #[task] + fn foo(_: foo::Context) {} +} diff --git a/macros/ui/task-init.stderr b/macros/ui/task-init.stderr new file mode 100644 index 0000000..911af37 --- /dev/null +++ b/macros/ui/task-init.stderr @@ -0,0 +1,5 @@ +error: this identifier has already been used + --> $DIR/task-init.rs:16:8 + | +16 | fn foo(_: foo::Context) {} + | ^^^ diff --git a/macros/ui/task-interrupt-same-prio-spawn.rs b/macros/ui/task-interrupt-same-prio-spawn.rs new file mode 100644 index 0000000..741e60e --- /dev/null +++ b/macros/ui/task-interrupt-same-prio-spawn.rs @@ -0,0 +1,7 @@ +#![no_main] + +#[rtic_macros::mock_app(parse_binds, device = mock)] +mod app { + #[task(binds = SysTick, only_same_priority_spawn_please_fix_me)] + fn foo(_: foo::Context) {} +} diff --git a/macros/ui/task-interrupt-same-prio-spawn.stderr b/macros/ui/task-interrupt-same-prio-spawn.stderr new file mode 100644 index 0000000..171b850 --- /dev/null +++ b/macros/ui/task-interrupt-same-prio-spawn.stderr @@ -0,0 +1,5 @@ +error: hardware tasks are not allowed to be spawned, `only_same_priority_spawn_please_fix_me` is only for software tasks + --> ui/task-interrupt-same-prio-spawn.rs:5:29 + | +5 | #[task(binds = SysTick, only_same_priority_spawn_please_fix_me)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/macros/ui/task-interrupt.rs b/macros/ui/task-interrupt.rs new file mode 100644 index 0000000..71fef9a --- /dev/null +++ b/macros/ui/task-interrupt.rs @@ -0,0 +1,10 @@ +#![no_main] + +#[rtic_macros::mock_app(parse_binds, device = mock)] +mod app { + #[task(binds = SysTick)] + fn foo(_: foo::Context) {} + + #[task] + fn foo(_: foo::Context) {} +} diff --git a/macros/ui/task-interrupt.stderr b/macros/ui/task-interrupt.stderr new file mode 100644 index 0000000..6efb0f9 --- /dev/null +++ b/macros/ui/task-interrupt.stderr @@ -0,0 +1,5 @@ +error: this task is defined multiple times + --> $DIR/task-interrupt.rs:9:8 + | +9 | fn foo(_: foo::Context) {} + | ^^^ diff --git a/macros/ui/task-no-context.rs b/macros/ui/task-no-context.rs new file mode 100644 index 0000000..e2da625 --- /dev/null +++ b/macros/ui/task-no-context.rs @@ -0,0 +1,7 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[task] + fn foo() {} +} diff --git a/macros/ui/task-no-context.stderr b/macros/ui/task-no-context.stderr new file mode 100644 index 0000000..8bf3438 --- /dev/null +++ b/macros/ui/task-no-context.stderr @@ -0,0 +1,5 @@ +error: this task handler must have type signature `(async) fn(foo::Context, ..)` + --> ui/task-no-context.rs:6:8 + | +6 | fn foo() {} + | ^^^ diff --git a/macros/ui/task-priority-too-high.rs b/macros/ui/task-priority-too-high.rs new file mode 100644 index 0000000..8c32beb --- /dev/null +++ b/macros/ui/task-priority-too-high.rs @@ -0,0 +1,7 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[task(priority = 256)] + fn foo(_: foo::Context) {} +} diff --git a/macros/ui/task-priority-too-high.stderr b/macros/ui/task-priority-too-high.stderr new file mode 100644 index 0000000..5790c88 --- /dev/null +++ b/macros/ui/task-priority-too-high.stderr @@ -0,0 +1,5 @@ +error: this literal must be in the range 0...255 + --> ui/task-priority-too-high.rs:5:23 + | +5 | #[task(priority = 256)] + | ^^^ diff --git a/macros/ui/task-priority-too-low.rs b/macros/ui/task-priority-too-low.rs new file mode 100644 index 0000000..beed4de --- /dev/null +++ b/macros/ui/task-priority-too-low.rs @@ -0,0 +1,7 @@ +#![no_main] + +#[rtic_macros::mock_app(parse_binds, device = mock)] +mod app { + #[task(binds = UART0, priority = 0)] + fn foo(_: foo::Context) {} +} diff --git a/macros/ui/task-priority-too-low.stderr b/macros/ui/task-priority-too-low.stderr new file mode 100644 index 0000000..85c8660 --- /dev/null +++ b/macros/ui/task-priority-too-low.stderr @@ -0,0 +1,5 @@ +error: hardware tasks are not allowed to be at priority 0 + --> ui/task-priority-too-low.rs:5:38 + | +5 | #[task(binds = UART0, priority = 0)] + | ^ diff --git a/macros/ui/task-pub.rs b/macros/ui/task-pub.rs new file mode 100644 index 0000000..3cbd523 --- /dev/null +++ b/macros/ui/task-pub.rs @@ -0,0 +1,7 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[task] + pub fn foo(_: foo::Context) {} +} diff --git a/macros/ui/task-pub.stderr b/macros/ui/task-pub.stderr new file mode 100644 index 0000000..56e09b1 --- /dev/null +++ b/macros/ui/task-pub.stderr @@ -0,0 +1,5 @@ +error: this task handler must have type signature `(async) fn(foo::Context, ..)` + --> ui/task-pub.rs:6:12 + | +6 | pub fn foo(_: foo::Context) {} + | ^^^ diff --git a/macros/ui/task-unsafe.rs b/macros/ui/task-unsafe.rs new file mode 100644 index 0000000..44255f0 --- /dev/null +++ b/macros/ui/task-unsafe.rs @@ -0,0 +1,7 @@ +#![no_main] + +#[rtic_macros::mock_app(device = mock)] +mod app { + #[task] + unsafe fn foo(_: foo::Context) {} +} diff --git a/macros/ui/task-unsafe.stderr b/macros/ui/task-unsafe.stderr new file mode 100644 index 0000000..424c5af --- /dev/null +++ b/macros/ui/task-unsafe.stderr @@ -0,0 +1,5 @@ +error: this task handler must have type signature `(async) fn(foo::Context, ..)` + --> ui/task-unsafe.rs:6:15 + | +6 | unsafe fn foo(_: foo::Context) {} + | ^^^ |
