aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/cfail/init-resource-share-idle.rs31
-rw-r--r--tests/cfail/init-resource-share-task.rs36
-rw-r--r--tests/cfail/lock.rs20
-rw-r--r--tests/cfail/token-transfer.rs2
4 files changed, 79 insertions, 10 deletions
diff --git a/tests/cfail/init-resource-share-idle.rs b/tests/cfail/init-resource-share-idle.rs
new file mode 100644
index 00000000..d8332469
--- /dev/null
+++ b/tests/cfail/init-resource-share-idle.rs
@@ -0,0 +1,31 @@
+#![deny(warnings)]
+#![feature(proc_macro)]
+#![no_std]
+
+extern crate cortex_m_rtfm as rtfm;
+extern crate stm32f103xx;
+
+use rtfm::app;
+
+app! { //~ proc macro panicked
+ device: stm32f103xx,
+
+ resources: {
+ static BUFFER: [u8; 16] = [0; 16];
+ },
+
+ init: {
+ resources: [BUFFER],
+ },
+
+ idle: {
+ // ERROR resources assigned to `init` can't be shared with `idle`
+ resources: [BUFFER],
+ },
+}
+
+fn init(_p: init::Peripherals, _r: init::Resources) {}
+
+fn idle(_r: init::Resources) -> ! {
+ loop {}
+}
diff --git a/tests/cfail/init-resource-share-task.rs b/tests/cfail/init-resource-share-task.rs
new file mode 100644
index 00000000..8fe68899
--- /dev/null
+++ b/tests/cfail/init-resource-share-task.rs
@@ -0,0 +1,36 @@
+#![deny(warnings)]
+#![feature(proc_macro)]
+#![no_std]
+
+extern crate cortex_m_rtfm as rtfm;
+extern crate stm32f103xx;
+
+use rtfm::app;
+
+app! { //~ proc macro panicked
+ device: stm32f103xx,
+
+ resources: {
+ static BUFFER: [u8; 16] = [0; 16];
+ },
+
+ init: {
+ resources: [BUFFER],
+ },
+
+ tasks: {
+ SYS_TICK: {
+ path: sys_tick,
+ // ERROR resources assigned to `init` can't be shared with tasks
+ resources: [BUFFER],
+ },
+ },
+}
+
+fn init(_p: init::Peripherals) {}
+
+fn idle() -> ! {
+ loop {}
+}
+
+fn sys_tick() {}
diff --git a/tests/cfail/lock.rs b/tests/cfail/lock.rs
index 5630649a..eb03b7d5 100644
--- a/tests/cfail/lock.rs
+++ b/tests/cfail/lock.rs
@@ -45,22 +45,24 @@ fn idle() -> ! {
}
fn exti0(mut t: &mut Threshold, mut r: EXTI0::Resources) {
+ // ERROR need to lock to access the resource because priority < ceiling
+ if *r.ON {
+ //~^ error type `EXTI0::ON` cannot be dereferenced
+ }
+
// OK need to lock to access the resource
- if r.ON.claim(&mut t, |on, _| **on) {}
+ if r.ON.claim(&mut t, |on, _| *on) {}
// OK can claim a resource with maximum ceiling
- r.MAX.claim_mut(&mut t, |max, _| **max += 1);
+ r.MAX.claim_mut(&mut t, |max, _| *max += 1);
}
fn exti1(mut t: &mut Threshold, r: EXTI1::Resources) {
- // ERROR no need to lock. Has direct access because priority == ceiling
- if (**r.ON).claim(&mut t, |on, _| **on) {
- //~^ error no method named `claim` found for type
- }
+ // OK to directly access the resource because priority == ceiling
+ if *r.ON {}
- if **r.ON {
- // OK
- }
+ // though the resource can still be claimed -- the claim is a no-op
+ if r.ON.claim(&mut t, |on, _| *on) {}
}
fn exti2(_t: &mut Threshold, _r: EXTI2::Resources) {}
diff --git a/tests/cfail/token-transfer.rs b/tests/cfail/token-transfer.rs
index bc620521..f92e4b2b 100644
--- a/tests/cfail/token-transfer.rs
+++ b/tests/cfail/token-transfer.rs
@@ -9,7 +9,7 @@ extern crate stm32f103xx;
use rtfm::{app, Threshold};
-app! { //~ error bound `rtfm::Threshold: core::marker::Send` is not satisfied
+app! { //~ error bound `*const (): core::marker::Send` is not satisfied
device: stm32f103xx,
resources: {