aboutsummaryrefslogtreecommitdiff
path: root/tests/cfail
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2018-11-03 16:31:11 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2018-11-03 16:31:11 +0000
commit777765e522949ebf84d05d4db075132172d81494 (patch)
tree41bc00739da8f832eb5ba68ef99ec8b9d06111a4 /tests/cfail
parent653338e7997a0cdc5deaed98b1bb5f60006717ed (diff)
parent3a867e70c3b1afc4943ec597e4f188432fba5a8b (diff)
Merge #97
97: v0.4.0 r=japaric a=japaric closes #32 closes #33 Co-authored-by: Jorge Aparicio <jorge@japaric.io>
Diffstat (limited to 'tests/cfail')
-rw-r--r--tests/cfail/critical-section.rs47
-rw-r--r--tests/cfail/duplicated-task.rs27
-rw-r--r--tests/cfail/exception-divergent.rs20
-rw-r--r--tests/cfail/exception-input.rs19
-rw-r--r--tests/cfail/exception-invalid.rs19
-rw-r--r--tests/cfail/exception-output.rs20
-rw-r--r--tests/cfail/exception-sys-tick.rs19
-rw-r--r--tests/cfail/exception.rs26
-rw-r--r--tests/cfail/idle-input.rs19
-rw-r--r--tests/cfail/idle-not-divergent.rs19
-rw-r--r--tests/cfail/idle.rs17
-rw-r--r--tests/cfail/init-divergent.rs17
-rw-r--r--tests/cfail/init-input.rs16
-rw-r--r--tests/cfail/init-not-send.rs30
-rw-r--r--tests/cfail/init-output.rs17
-rw-r--r--tests/cfail/init-resource-share-idle.rs30
-rw-r--r--tests/cfail/init-resource-share-task.rs35
-rw-r--r--tests/cfail/init.rs19
-rw-r--r--tests/cfail/insufficient-free-interrupts.rs17
-rw-r--r--tests/cfail/interrupt-divergent.rs20
-rw-r--r--tests/cfail/interrupt-input.rs19
-rw-r--r--tests/cfail/interrupt-output.rs20
-rw-r--r--tests/cfail/interrupt.rs26
-rw-r--r--tests/cfail/late-assigned-to-init.rs16
-rw-r--r--tests/cfail/late-not-send.rs31
-rw-r--r--tests/cfail/late-resource-init.rs49
-rw-r--r--tests/cfail/late-uninit.rs16
-rw-r--r--tests/cfail/lock.rs67
-rw-r--r--tests/cfail/needs-send.rs30
-rw-r--r--tests/cfail/needs-sync.rs36
-rw-r--r--tests/cfail/peripheral-alias.rs27
-rw-r--r--tests/cfail/priority-too-high.rs30
-rw-r--r--tests/cfail/priority-too-low.rs30
-rw-r--r--tests/cfail/resource-alias.rs31
-rw-r--r--tests/cfail/resource-not-declared.rs14
-rw-r--r--tests/cfail/resource-not-send-sync.rs53
-rw-r--r--tests/cfail/resource-pub.rs17
-rw-r--r--tests/cfail/task-divergent.rs24
-rw-r--r--tests/cfail/task-idle.rs23
-rw-r--r--tests/cfail/task-not-declared.rs14
-rw-r--r--tests/cfail/token-outlive.rs45
-rw-r--r--tests/cfail/token-transfer.rs36
-rw-r--r--tests/cfail/used-free-interrupt.rs21
-rw-r--r--tests/cfail/wrong-threshold.rs47
44 files changed, 533 insertions, 642 deletions
diff --git a/tests/cfail/critical-section.rs b/tests/cfail/critical-section.rs
deleted file mode 100644
index c0f475c..0000000
--- a/tests/cfail/critical-section.rs
+++ /dev/null
@@ -1,47 +0,0 @@
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![feature(const_fn)]
-#![no_std]
-
-extern crate cortex_m_rtfm as rtfm;
-extern crate stm32f103xx;
-
-use rtfm::{app, Resource, Threshold};
-
-app! {
- device: stm32f103xx,
-
- resources: {
- static ON: bool = false;
- },
-
- idle: {
- resources: [ON],
- },
-
- tasks: {
- EXTI0: {
- path: exti0,
- priority: 1,
- resources: [ON],
- },
- },
-}
-
-fn init(_p: init::Peripherals, _r: init::Resources) {}
-
-fn idle(t: &mut Threshold, r: idle::Resources) -> ! {
- let state = rtfm::atomic(t, |t| {
- // ERROR borrow can't escape this *global* critical section
- r.ON.borrow(t) //~ error cannot infer an appropriate lifetime
- });
-
- let state = r.ON.claim(t, |state, _t| {
- // ERROR borrow can't escape this critical section
- state //~ error cannot infer an appropriate lifetime
- });
-
- loop {}
-}
-
-fn exti0(_t: &mut Threshold, _r: EXTI0::Resources) {}
diff --git a/tests/cfail/duplicated-task.rs b/tests/cfail/duplicated-task.rs
deleted file mode 100644
index 885c961..0000000
--- a/tests/cfail/duplicated-task.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_std]
-
-extern crate cortex_m_rtfm as rtfm;
-extern crate stm32f103xx;
-
-use rtfm::app;
-
-app! {
- //~^ error proc macro panicked
- device: stm32f103xx,
-
- tasks: {
- SYS_TICK: {
- priority: 1,
- },
-
- SYS_TICK: {
- priority: 2,
- },
- },
-}
-
-fn init(_p: init::Peripherals) {}
-
-fn idle() -> ! {}
diff --git a/tests/cfail/exception-divergent.rs b/tests/cfail/exception-divergent.rs
new file mode 100644
index 0000000..692a57c
--- /dev/null
+++ b/tests/cfail/exception-divergent.rs
@@ -0,0 +1,20 @@
+#![no_main]
+#![no_std]
+
+extern crate lm3s6965;
+extern crate panic_halt;
+extern crate rtfm;
+
+use rtfm::app;
+
+#[app(device = lm3s6965)]
+const APP: () = {
+ #[init]
+ fn init() {}
+
+ #[exception]
+ fn SVCall() -> ! {
+ //~^ ERROR `exception` handlers must have type signature `[unsafe] fn()`
+ loop {}
+ }
+};
diff --git a/tests/cfail/exception-input.rs b/tests/cfail/exception-input.rs
new file mode 100644
index 0000000..cb0711c
--- /dev/null
+++ b/tests/cfail/exception-input.rs
@@ -0,0 +1,19 @@
+#![no_main]
+#![no_std]
+
+extern crate lm3s6965;
+extern crate panic_halt;
+extern crate rtfm;
+
+use rtfm::app;
+
+#[app(device = lm3s6965)]
+const APP: () = {
+ #[init]
+ fn init() {}
+
+ #[exception]
+ fn SVCall(undef: u32) {
+ //~^ ERROR `exception` handlers must have type signature `[unsafe] fn()`
+ }
+};
diff --git a/tests/cfail/exception-invalid.rs b/tests/cfail/exception-invalid.rs
new file mode 100644
index 0000000..0a7fb52
--- /dev/null
+++ b/tests/cfail/exception-invalid.rs
@@ -0,0 +1,19 @@
+#![no_main]
+#![no_std]
+
+extern crate lm3s6965;
+extern crate panic_halt;
+extern crate rtfm;
+
+use rtfm::app;
+
+#[app(device = lm3s6965)]
+const APP: () = {
+ #[init]
+ fn init() {}
+
+ #[exception]
+ fn NonMaskableInt() {
+ //~^ ERROR only exceptions with configurable priority can be used as hardware tasks
+ }
+};
diff --git a/tests/cfail/exception-output.rs b/tests/cfail/exception-output.rs
new file mode 100644
index 0000000..758dbdd
--- /dev/null
+++ b/tests/cfail/exception-output.rs
@@ -0,0 +1,20 @@
+#![no_main]
+#![no_std]
+
+extern crate lm3s6965;
+extern crate panic_halt;
+extern crate rtfm;
+
+use rtfm::app;
+
+#[app(device = lm3s6965)]
+const APP: () = {
+ #[init]
+ fn init() {}
+
+ #[exception]
+ fn SVCall() -> u32 {
+ //~^ ERROR `exception` handlers must have type signature `[unsafe] fn()`
+ 0
+ }
+};
diff --git a/tests/cfail/exception-sys-tick.rs b/tests/cfail/exception-sys-tick.rs
new file mode 100644
index 0000000..69d73db
--- /dev/null
+++ b/tests/cfail/exception-sys-tick.rs
@@ -0,0 +1,19 @@
+#![no_main]
+#![no_std]
+
+extern crate lm3s6965;
+extern crate panic_halt;
+extern crate rtfm;
+
+use rtfm::app;
+
+#[app(device = lm3s6965)]
+const APP: () = {
+ #[init]
+ fn init() {}
+
+ #[exception]
+ fn SysTick() {
+ //~^ ERROR the `SysTick` exception can't be used because it's used by the runtime
+ }
+};
diff --git a/tests/cfail/exception.rs b/tests/cfail/exception.rs
deleted file mode 100644
index b4e025f..0000000
--- a/tests/cfail/exception.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_std]
-
-extern crate cortex_m_rtfm as rtfm;
-extern crate stm32f103xx;
-
-use rtfm::app;
-
-app! { //~ error proc macro panicked
- device: stm32f103xx,
-
- tasks: {
- // ERROR exceptions can't be enabled / disabled here
- SYS_TICK: {
- enabled: true,
- priority: 1,
- },
- },
-}
-
-fn init(_p: init::Peripherals) {}
-
-fn idle() -> ! {
- loop {}
-}
diff --git a/tests/cfail/idle-input.rs b/tests/cfail/idle-input.rs
new file mode 100644
index 0000000..5095977
--- /dev/null
+++ b/tests/cfail/idle-input.rs
@@ -0,0 +1,19 @@
+#![no_main]
+#![no_std]
+
+extern crate lm3s6965;
+extern crate panic_halt;
+extern crate rtfm;
+
+use rtfm::app;
+
+#[app(device = lm3s6965)]
+const APP: () = {
+ #[init]
+ fn init() {}
+
+ #[idle]
+ fn idle(undef: u32) {
+ //~^ ERROR `idle` must have type signature `[unsafe] fn() -> !`
+ }
+};
diff --git a/tests/cfail/idle-not-divergent.rs b/tests/cfail/idle-not-divergent.rs
new file mode 100644
index 0000000..e90eff0
--- /dev/null
+++ b/tests/cfail/idle-not-divergent.rs
@@ -0,0 +1,19 @@
+#![no_main]
+#![no_std]
+
+extern crate lm3s6965;
+extern crate panic_halt;
+extern crate rtfm;
+
+use rtfm::app;
+
+#[app(device = lm3s6965)]
+const APP: () = {
+ #[init]
+ fn init() {}
+
+ #[idle]
+ fn idle() {
+ //~^ ERROR `idle` must have type signature `[unsafe] fn() -> !`
+ }
+};
diff --git a/tests/cfail/idle.rs b/tests/cfail/idle.rs
deleted file mode 100644
index ef20e1a..0000000
--- a/tests/cfail/idle.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_std]
-
-extern crate cortex_m_rtfm as rtfm;
-extern crate stm32f103xx;
-
-use rtfm::app;
-
-app! { //~ error mismatched types
- device: stm32f103xx,
-}
-
-fn init(_p: init::Peripherals) {}
-
-// ERROR `idle` must be a diverging function
-fn idle() {}
diff --git a/tests/cfail/init-divergent.rs b/tests/cfail/init-divergent.rs
new file mode 100644
index 0000000..400c805
--- /dev/null
+++ b/tests/cfail/init-divergent.rs
@@ -0,0 +1,17 @@
+#![no_main]
+#![no_std]
+
+extern crate lm3s6965;
+extern crate panic_halt;
+extern crate rtfm;
+
+use rtfm::app;
+
+#[app(device = lm3s6965)]
+const APP: () = {
+ #[init]
+ fn init() -> ! {
+ //~^ ERROR `init` must have type signature `[unsafe] fn()`
+ loop {}
+ }
+};
diff --git a/tests/cfail/init-input.rs b/tests/cfail/init-input.rs
new file mode 100644
index 0000000..fa79099
--- /dev/null
+++ b/tests/cfail/init-input.rs
@@ -0,0 +1,16 @@
+#![no_main]
+#![no_std]
+
+extern crate lm3s6965;
+extern crate panic_halt;
+extern crate rtfm;
+
+use rtfm::app;
+
+#[app(device = lm3s6965)]
+const APP: () = {
+ #[init]
+ fn init(undef: u32) {
+ //~^ ERROR `init` must have type signature `[unsafe] fn()`
+ }
+};
diff --git a/tests/cfail/init-not-send.rs b/tests/cfail/init-not-send.rs
new file mode 100644
index 0000000..3ac495f
--- /dev/null
+++ b/tests/cfail/init-not-send.rs
@@ -0,0 +1,30 @@
+//! This is equivalent to the `late-not-send` cfail test
+
+#![feature(extern_crate_item_prelude)] // ???
+#![no_main]
+#![no_std]
+
+extern crate lm3s6965;
+extern crate panic_halt;
+extern crate rtfm;
+
+use core::marker::PhantomData;
+
+use rtfm::app;
+
+pub struct NotSend {
+ _0: PhantomData<*const ()>,
+}
+
+#[app(device = lm3s6965)] //~ ERROR `*const ()` cannot be sent between threads safely
+const APP: () = {
+ static mut X: Option<NotSend> = None;
+
+ #[init(resources = [X])]
+ fn init() {
+ *resources.X = Some(NotSend { _0: PhantomData })
+ }
+
+ #[interrupt(resources = [X])]
+ fn UART0() {}
+};
diff --git a/tests/cfail/init-output.rs b/tests/cfail/init-output.rs
new file mode 100644
index 0000000..1200aca
--- /dev/null
+++ b/tests/cfail/init-output.rs
@@ -0,0 +1,17 @@
+#![no_main]
+#![no_std]
+
+extern crate lm3s6965;
+extern crate panic_halt;
+extern crate rtfm;
+
+use rtfm::app;
+
+#[app(device = lm3s6965)]
+const APP: () = {
+ #[init]
+ fn init() -> u32 {
+ //~^ ERROR `init` must have type signature `[unsafe] fn()`
+ 0
+ }
+};
diff --git a/tests/cfail/init-resource-share-idle.rs b/tests/cfail/init-resource-share-idle.rs
deleted file mode 100644
index 5b29f30..0000000
--- a/tests/cfail/init-resource-share-idle.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-#![deny(warnings)]
-#![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: {
- resources: [BUFFER],
- //~^ error: this resource is owned by `init` and can't be shared
- },
-}
-
-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
deleted file mode 100644
index a93e840..0000000
--- a/tests/cfail/init-resource-share-task.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-#![deny(warnings)]
-#![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,
- resources: [BUFFER],
- //~^ error: this resource is owned by `init` and can't be shared
- },
- },
-}
-
-fn init(_p: init::Peripherals) {}
-
-fn idle() -> ! {
- loop {}
-}
-
-fn sys_tick() {}
diff --git a/tests/cfail/init.rs b/tests/cfail/init.rs
deleted file mode 100644
index 057a2ee..0000000
--- a/tests/cfail/init.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_std]
-
-extern crate cortex_m_rtfm as rtfm;
-extern crate stm32f103xx;
-
-use rtfm::app;
-
-app! { //~ error mismatched types
- device: stm32f103xx,
-}
-
-// ERROR `init` must have signature `fn (init::Peripherals)`
-fn init() {}
-
-fn idle() -> ! {
- loop {}
-}
diff --git a/tests/cfail/insufficient-free-interrupts.rs b/tests/cfail/insufficient-free-interrupts.rs
new file mode 100644
index 0000000..baa2582
--- /dev/null
+++ b/tests/cfail/insufficient-free-interrupts.rs
@@ -0,0 +1,17 @@
+#![no_main]
+#![no_std]
+
+extern crate lm3s6965;
+extern crate panic_halt;
+extern crate rtfm;
+
+use rtfm::app;
+
+#[app(device = lm3s6965)] //~ ERROR 1 free interrupt (`extern { .. }`) is required
+const APP: () = {
+ #[init]
+ fn init() {}
+
+ #[task]
+ fn foo() {}
+};
diff --git a/tests/cfail/interrupt-divergent.rs b/tests/cfail/interrupt-divergent.rs
new file mode 100644
index 0000000..4a01533
--- /dev/null
+++ b/tests/cfail/interrupt-divergent.rs
@@ -0,0 +1,20 @@
+#![no_main]
+#![no_std]
+
+extern crate lm3s6965;
+extern crate panic_halt;
+extern crate rtfm;
+
+use rtfm::app;
+
+#[app(device = lm3s6965)]
+const APP: () = {
+ #[init]
+ fn init() {}
+
+ #[interrupt]
+ fn UART0() -> ! {
+ //~^ ERROR `interrupt` handlers must have type signature `[unsafe] fn()`
+ loop {}
+ }
+};
diff --git a/tests/cfail/interrupt-input.rs b/tests/cfail/interrupt-input.rs
new file mode 100644
index 0000000..d0240f4
--- /dev/null
+++ b/tests/cfail/interrupt-input.rs
@@ -0,0 +1,19 @@
+#![no_main]
+#![no_std]
+
+extern crate lm3s6965;
+extern crate panic_halt;
+extern crate rtfm;
+
+use rtfm::app;
+
+#[app(device = lm3s6965)]
+const APP: () = {
+ #[init]
+ fn init() {}
+
+ #[interrupt]
+ fn UART0(undef: u32) {
+ //~^ ERROR `interrupt` handlers must have type signature `[unsafe] fn()`
+ }
+};
diff --git a/tests/cfail/interrupt-output.rs b/tests/cfail/interrupt-output.rs
new file mode 100644
index 0000000..37cd7c2
--- /dev/null
+++ b/tests/cfail/interrupt-output.rs
@@ -0,0 +1,20 @@
+#![no_main]
+#![no_std]
+
+extern crate lm3s6965;
+extern crate panic_halt;
+extern crate rtfm;
+
+use rtfm::app;
+
+#[app(device = lm3s6965)]
+const APP: () = {
+ #[init]
+ fn init() {}
+
+ #[interrupt]
+ fn UART0() -> u32 {
+ //~^ ERROR `interrupt` handlers must have type signature `[unsafe] fn()`
+ 0
+ }
+};
diff --git a/tests/cfail/interrupt.rs b/tests/cfail/interrupt.rs
deleted file mode 100644
index 522763a..0000000
--- a/tests/cfail/interrupt.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_std]
-
-extern crate cortex_m_rtfm as rtfm;
-extern crate stm32f103xx;
-
-use rtfm::app;
-
-app! { //~ error no variant named `EXTI33` found for type
- device: stm32f103xx,
-
- tasks: {
- EXTI33: {
- path: exti33,
- },
- },
-}
-
-fn init(_p: init::Peripherals) {}
-
-fn idle() -> ! {
- loop {}
-}
-
-fn exti33() {}
diff --git a/tests/cfail/late-assigned-to-init.rs b/tests/cfail/late-assigned-to-init.rs
new file mode 100644
index 0000000..70a361c
--- /dev/null
+++ b/tests/cfail/late-assigned-to-init.rs
@@ -0,0 +1,16 @@
+#![no_main]
+#![no_std]
+
+extern crate lm3s6965;
+extern crate panic_halt;
+extern crate rtfm;
+
+use rtfm::app;
+
+#[app(device = lm3s6965)]
+const APP: () = {
+ static mut X: u32 = ();
+
+ #[init(resources = [X])] //~ ERROR late resources can NOT be assigned to `init`
+ fn init() {}
+};
diff --git a/tests/cfail/late-not-send.rs b/tests/cfail/late-not-send.rs
new file mode 100644
index 0000000..b9180fe
--- /dev/null
+++ b/tests/cfail/late-not-send.rs
@@ -0,0 +1,31 @@
+//! `init` has a static priority of `0`. Initializing resources from it is equivalent to sending a
+//! message to the task that will own the resource
+
+#![feature(extern_crate_item_prelude)] // ???
+#![no_main]
+#![no_std]
+
+extern crate lm3s6965;
+extern crate panic_halt;
+extern crate rtfm;
+
+use core::marker::PhantomData;
+
+use rtfm::app;
+
+struct NotSend {
+ _0: PhantomData<*const ()>,
+}
+
+#[app(device = lm3s6965)] //~ ERROR `*const ()` cannot be sent between threads safely
+const APP: () = {
+ static mut X: NotSend = ();
+
+ #[init]
+ fn init() {
+ X = NotSend { _0: PhantomData };
+ }
+
+ #[interrupt(resources = [X])]
+ fn UART0() {}
+};
diff --git a/tests/cfail/late-resource-init.rs b/tests/cfail/late-resource-init.rs
deleted file mode 100644
index 5235d93..0000000
--- a/tests/cfail/late-resource-init.rs
+++ /dev/null
@@ -1,49 +0,0 @@
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_std]
-
-extern crate cortex_m_rtfm as rtfm;
-extern crate stm32f103xx;
-
-use rtfm::{app, Threshold};
-
-app! {
- device: stm32f103xx,
-
- resources: {
- static A: u8 = 0;
- static LATE: u8;
- },
-
- tasks: {
- EXTI0: {
- path: exti0,
- priority: 1,
- resources: [A, LATE],
- },
-
- EXTI1: {
- path: exti1,
- priority: 2,
- resources: [A, LATE],
- },
- },
-}
-
-fn init(_p: init::Peripherals, r: init::Resources) -> init::LateResources {
- // Try to use a resource that's not yet initialized:
- r.LATE;
- //~^ error: no field `LATE`
-
- init::LateResources {
- LATE: 0,
- }
-}
-
-fn idle() -> ! {
- loop {}
-}
-
-fn exti0(_t: &mut Threshold, _r: EXTI0::Resources) {}
-
-fn exti1(_t: &mut Threshold, _r: EXTI1::Resources) {}
diff --git a/tests/cfail/late-uninit.rs b/tests/cfail/late-uninit.rs
new file mode 100644
index 0000000..eeb9bd4
--- /dev/null
+++ b/tests/cfail/late-uninit.rs
@@ -0,0 +1,16 @@
+#![no_main]
+#![no_std]
+
+extern crate lm3s6965;
+extern crate panic_halt;
+extern crate rtfm;
+
+use rtfm::app;
+
+#[app(device = lm3s6965)]
+const APP: () = {
+ static mut X: u32 = (); //~ ERROR late resources MUST be initialized at the end of `init`
+
+ #[init]
+ fn init() {}
+};
diff --git a/tests/cfail/lock.rs b/tests/cfail/lock.rs
deleted file mode 100644
index 9cb0f3e..0000000
--- a/tests/cfail/lock.rs
+++ /dev/null
@@ -1,67 +0,0 @@
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![feature(const_fn)]
-#![no_std]
-
-extern crate cortex_m_rtfm as rtfm;
-extern crate stm32f103xx;
-
-use rtfm::{app, Resource, Threshold};
-
-app! {
- device: stm32f103xx,
-
- resources: {
- static ON: bool = false;
- static MAX: u8 = 0;
- },
-
- tasks: {
- EXTI0: {
- path: exti0,
- priority: 1,
- resources: [MAX, ON],
- },
-
- EXTI1: {
- path: exti1,
- priority: 2,
- resources: [ON],
- },
-
- EXTI2: {
- path: exti2,
- priority: 16,
- resources: [MAX],
- },
- },
-}
-
-fn init(_p: init::Peripherals, _r: init::Resources) {}
-
-fn idle() -> ! {
- loop {}
-}
-
-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) {}
-
- // OK can claim a resource with maximum ceiling
- r.MAX.claim_mut(&mut t, |max, _| *max += 1);
-}
-
-fn exti1(mut t: &mut Threshold, r: EXTI1::Resources) {
- // OK to directly access the resource because priority == ceiling
- if *r.ON {}
-
- // 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/needs-send.rs b/tests/cfail/needs-send.rs
new file mode 100644
index 0000000..7e3ca30
--- /dev/null
+++ b/tests/cfail/needs-send.rs
@@ -0,0 +1,30 @@
+#![feature(extern_crate_item_prelude)] // ???
+#![no_main]
+#![no_std]
+
+extern crate lm3s6965;
+extern crate panic_halt;
+extern crate rtfm;
+
+use core::marker::PhantomData;
+
+use rtfm::app;
+
+pub struct NotSend {
+ _0: PhantomData<*const ()>,
+}
+
+unsafe impl Sync for NotSend {}
+
+#[app(device = lm3s6965)] //~ ERROR cannot be sent between threads safely
+const APP: () = {
+ #[init(spawn = [foo])]
+ fn init() {}
+
+ #[task]
+ fn foo(_x: NotSend) {}
+
+ extern "C" {
+ fn UART0();
+ }
+};
diff --git a/tests/cfail/needs-sync.rs b/tests/cfail/needs-sync.rs
new file mode 100644
index 0000000..f25f91a
--- /dev/null
+++ b/tests/cfail/needs-sync.rs
@@ -0,0 +1,36 @@
+#![feature(extern_crate_item_prelude)] // ???
+#![no_main]
+#![no_std]
+
+extern crate lm3s6965;
+extern crate panic_halt;
+extern crate rtfm;
+
+use core::marker::PhantomData;
+
+use rtfm::app;
+
+pub struct NotSync {
+ _0: PhantomData<*const ()>,
+}
+
+unsafe impl Send for NotSync {}
+
+#[app(device = lm3s6965)] //~ ERROR cannot be shared between threads safely
+const APP: () = {
+ static X: NotSync = NotSync { _0: PhantomData };
+
+ #[init(spawn = [foo])]
+ fn init() {}
+
+ #[task(priority = 1, resources = [X])]
+ fn foo() {}
+
+ #[task(priority = 2, resources = [X])]
+ fn bar() {}
+
+ extern "C" {
+ fn UART0();
+ fn UART1();
+ }
+};
diff --git a/tests/cfail/peripheral-alias.rs b/tests/cfail/peripheral-alias.rs
deleted file mode 100644
index 7f3790a..0000000
--- a/tests/cfail/peripheral-alias.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_std]
-
-extern crate cortex_m_rtfm as rtfm;
-extern crate stm32f103xx;
-
-use rtfm::app;
-
-app! { //~ error proc macro panicked
- device: stm32f103xx,
-
- tasks: {
- EXTI0: {
- enabled: true,
- priority: 1,
- // ERROR peripheral appears twice in this list
- resources: [GPIOA, GPIOA],
- },
- },
-}
-
-fn init(_p: init::Peripherals) {}
-
-fn idle() -> ! {
- loop {}
-}
diff --git a/tests/cfail/priority-too-high.rs b/tests/cfail/priority-too-high.rs
deleted file mode 100644
index d63b9d0..0000000
--- a/tests/cfail/priority-too-high.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_std]
-
-extern crate cortex_m_rtfm as rtfm;
-extern crate stm32f103xx;
-
-use rtfm::app;
-
-app! { //~ error referenced constant has errors
- //~^ error could not evaluate constant
- //~| error constant evaluation error
- device: stm32f103xx,
-
- tasks: {
- SYS_TICK: {
- path: sys_tick,
- // ERROR priority must be in the range [1, 16]
- priority: 17,
- },
- },
-}
-
-fn init(_p: init::Peripherals) {}
-
-fn idle() -> ! {
- loop {}
-}
-
-fn sys_tick() {}
diff --git a/tests/cfail/priority-too-low.rs b/tests/cfail/priority-too-low.rs
deleted file mode 100644
index 476b7a0..0000000
--- a/tests/cfail/priority-too-low.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_std]
-
-extern crate cortex_m_rtfm as rtfm;
-extern crate stm32f103xx;
-
-use rtfm::app;
-
-app! { //~ error referenced constant has errors
- //~^ error could not evaluate constant
- //~| error constant evaluation error
- device: stm32f103xx,
-
- tasks: {
- SYS_TICK: {
- path: sys_tick,
- // ERROR priority must be in the range [1, 16]
- priority: 0,
- },
- },
-}
-
-fn init(_p: init::Peripherals) {}
-
-fn idle() -> ! {
- loop {}
-}
-
-fn sys_tick() {}
diff --git a/tests/cfail/resource-alias.rs b/tests/cfail/resource-alias.rs
deleted file mode 100644
index 81eeea0..0000000
--- a/tests/cfail/resource-alias.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_std]
-
-extern crate cortex_m_rtfm as rtfm;
-extern crate stm32f103xx;
-
-use rtfm::app;
-
-app! { //~ error proc macro panicked
- device: stm32f103xx,
-
- resources: {
- // resource `MAX` listed twice
- MAX: u8 = 0;
- MAX: u16 = 0;
- },
-
- tasks: {
- EXTI0: {
- enabled: true,
- priority: 1,
- },
- },
-}
-
-fn init(_p: init::Peripherals) {}
-
-fn idle() -> ! {
- loop {}
-}
diff --git a/tests/cfail/resource-not-declared.rs b/tests/cfail/resource-not-declared.rs
new file mode 100644
index 0000000..f6d08a6
--- /dev/null
+++ b/tests/cfail/resource-not-declared.rs
@@ -0,0 +1,14 @@
+#![no_main]
+#![no_std]
+
+extern crate lm3s6965;
+extern crate panic_halt;
+extern crate rtfm;
+
+use rtfm::app;
+
+#[app(device = lm3s6965)]
+const APP: () = {
+ #[init(resources = [X])] //~ ERROR this resource has NOT been declared
+ fn init() {}
+};
diff --git a/tests/cfail/resource-not-send-sync.rs b/tests/cfail/resource-not-send-sync.rs
deleted file mode 100644
index 27e5cb0..0000000
--- a/tests/cfail/resource-not-send-sync.rs
+++ /dev/null
@@ -1,53 +0,0 @@
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![feature(const_fn)]
-#![no_std]
-
-extern crate cortex_m_rtfm as rtfm;
-extern crate stm32f103xx;
-
-use rtfm::{app, Threshold};
-
-app! {
- device: stm32f103xx,
-
- resources: {
- static SHARED: bool = false;
- },
-
- tasks: {
- EXTI0: {
- path: exti0,
- priority: 1,
- resources: [SHARED],
- },
-
- EXTI1: {
- path: exti1,
- priority: 2,
- resources: [SHARED],
- },
- },
-}
-
-fn init(_p: init::Peripherals, _r: init::Resources) {}
-
-fn idle() -> ! {
- loop {}
-}
-
-fn is_send<T>(_: &T) where T: Send {}
-fn is_sync<T>(_: &T) where T: Sync {}
-
-fn exti0(_t: &mut Threshold, r: EXTI0::Resources) {
- // ERROR resource proxies can't be shared between tasks
- is_sync(&r.SHARED);
- //~^ error `*const ()` cannot be shared between threads safely
-
- // ERROR resource proxies are not `Send`able across tasks
- is_send(&r.SHARED);
- //~^ error `*const ()` cannot be sent between threads safely
-}
-
-fn exti1(_t: &mut Threshold, _r: EXTI1::Resources) {
-}
diff --git a/tests/cfail/resource-pub.rs b/tests/cfail/resource-pub.rs
new file mode 100644
index 0000000..970fc6c
--- /dev/null
+++ b/tests/cfail/resource-pub.rs
@@ -0,0 +1,17 @@
+#![no_main]
+#![no_std]
+
+extern crate lm3s6965;
+extern crate panic_halt;
+extern crate rtfm;
+
+use rtfm::app;
+
+#[app(device = lm3s6965)]
+const APP: () = {
+ pub static mut X: u32 = 0;
+ //~^ ERROR resources must have inherited / private visibility
+
+ #[init]
+ fn init() {}
+};
diff --git a/tests/cfail/task-divergent.rs b/tests/cfail/task-divergent.rs
new file mode 100644
index 0000000..3822d75
--- /dev/null
+++ b/tests/cfail/task-divergent.rs
@@ -0,0 +1,24 @@
+#![no_main]
+#![no_std]
+
+extern crate lm3s6965;
+extern crate panic_halt;
+extern crate rtfm;
+
+use rtfm::app;
+
+#[app(device = lm3s6965)]
+const APP: () = {
+ #[init]
+ fn init() {}
+
+ #[task]
+ fn foo() -> ! {
+ //~^ ERROR `task` handlers must have type signature `[unsafe] fn(..)`
+ loop {}
+ }
+
+ extern "C" {
+ fn UART0();
+ }
+};
diff --git a/tests/cfail/task-idle.rs b/tests/cfail/task-idle.rs
new file mode 100644
index 0000000..62d927b
--- /dev/null
+++ b/tests/cfail/task-idle.rs
@@ -0,0 +1,23 @@
+#![no_main]
+#![no_std]
+
+extern crate lm3s6965;
+extern crate panic_halt;
+extern crate rtfm;
+
+use rtfm::app;
+
+#[app(device = lm3s6965)]
+const APP: () = {
+ #[init]
+ fn init() {}
+
+ #[task]
+ fn idle() {
+ //~^ ERROR `task` handlers can NOT be named `idle`, `init` or `resources`
+ }
+
+ extern "C" {
+ fn UART0();
+ }
+};
diff --git a/tests/cfail/task-not-declared.rs b/tests/cfail/task-not-declared.rs
new file mode 100644
index 0000000..3e6d87c
--- /dev/null
+++ b/tests/cfail/task-not-declared.rs
@@ -0,0 +1,14 @@
+#![no_main]
+#![no_std]
+
+extern crate lm3s6965;
+extern crate panic_halt;
+extern crate rtfm;
+
+use rtfm::app;
+
+#[app(device = lm3s6965)]
+const APP: () = {
+ #[init(spawn = [X])] //~ ERROR this task has NOT been declared
+ fn init() {}
+};
diff --git a/tests/cfail/token-outlive.rs b/tests/cfail/token-outlive.rs
deleted file mode 100644
index 41ee827..0000000
--- a/tests/cfail/token-outlive.rs
+++ /dev/null
@@ -1,45 +0,0 @@
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![feature(const_fn)]
-#![no_std]
-
-extern crate cortex_m_rtfm as rtfm;
-extern crate stm32f103xx;
-
-use rtfm::{app, Resource, Threshold};
-
-app! {
- device: stm32f103xx,
-
- resources: {
- static STATE: bool = false;
- },
-
- tasks: {
- EXTI0: {
- path: exti0,
- priority: 1,
- resources: [STATE],
- },
-
- EXTI1: {
- path: exti1,
- priority: 2,
- resources: [STATE],
- },
- },
-}
-
-fn init(_p: init::Peripherals, _r: init::Resources) {}
-
-fn idle() -> ! {
- loop {}
-}
-
-fn exti0(mut t: &mut Threshold, r: EXTI0::Resources) {
- // ERROR token should not outlive the critical section
- let t = r.STATE.claim(&mut t, |_state, t| t);
- //~^ error cannot infer an appropriate lifetime
-}
-
-fn exti1(_t: &mut Threshold, _r: EXTI1::Resources) {}
diff --git a/tests/cfail/token-transfer.rs b/tests/cfail/token-transfer.rs
deleted file mode 100644
index 5c6a22b..0000000
--- a/tests/cfail/token-transfer.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![feature(const_fn)]
-#![no_std]
-
-extern crate cortex_m_rtfm as rtfm;
-extern crate stm32f103xx;
-
-use rtfm::{app, Threshold};
-
-app! { //~ error `*const ()` cannot be sent between threads safely
- device: stm32f103xx,
-
- resources: {
- static TOKEN: Option<Threshold> = None;
- },
-
- idle: {
- resources: [TOKEN],
- },
-
- tasks: {
- EXTI0: {
- path: exti0,
- resources: [TOKEN],
- },
- }
-}
-
-fn init(_p: init::Peripherals, _r: init::Resources) {}
-
-fn idle(_t: &mut Threshold, _r: idle::Resources) -> ! {
- loop {}
-}
-
-fn exti0(_t: &mut Threshold, _r: EXTI0::Resources) {}
diff --git a/tests/cfail/used-free-interrupt.rs b/tests/cfail/used-free-interrupt.rs
new file mode 100644
index 0000000..78ae540
--- /dev/null
+++ b/tests/cfail/used-free-interrupt.rs
@@ -0,0 +1,21 @@
+#![no_main]
+#![no_std]
+
+extern crate lm3s6965;
+extern crate panic_halt;
+extern crate rtfm;
+
+use rtfm::app;
+
+#[app(device = lm3s6965)]
+const APP: () = {
+ #[init]
+ fn init() {}
+
+ #[interrupt]
+ fn UART0() {} //~ ERROR free interrupts (`extern { .. }`) can't be used as interrupt handlers
+
+ extern "C" {
+ fn UART0();
+ }
+};
diff --git a/tests/cfail/wrong-threshold.rs b/tests/cfail/wrong-threshold.rs
deleted file mode 100644
index 86d8e26..0000000
--- a/tests/cfail/wrong-threshold.rs
+++ /dev/null
@@ -1,47 +0,0 @@
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_std]
-
-extern crate cortex_m_rtfm as rtfm;
-extern crate stm32f103xx;
-
-use rtfm::{app, Resource, Threshold};
-
-app! {
- device: stm32f103xx,
-
- resources: {
- static A: u8 = 0;
- static B: u8 = 0;
- },
-
- tasks: {
- EXTI0: {
- path: exti0,
- priority: 1,
- resources: [A, B],
- },
-
- EXTI1: {
- path: exti1,
- priority: 2,
- resources: [A, B],
- },
- },
-}
-
-fn init(_p: init::Peripherals, _r: init::Resources) {}
-
-fn idle() -> ! {
- loop {}
-}
-
-fn exti0(mut ot: &mut Threshold, r: EXTI0::Resources) {
- r.A.claim(&mut ot, |_a, mut _it| {
- //~^ error cannot borrow `ot` as mutable more than once at a time
- // ERROR must use inner token `it` instead of the outer one (`ot`)
- r.B.claim(&mut ot, |_b, _| {})
- });
-}
-
-fn exti1(_t: &mut Threshold, _r: EXTI1::Resources) {}