diff options
author | 2017-12-09 17:14:51 +0100 | |
---|---|---|
committer | 2017-12-09 17:17:56 +0100 | |
commit | d30bdcb096774c1f56d9823fb2fbb78bf5cd3584 (patch) | |
tree | 0a781ee30567a2f13de11d03f25736bf60d3866f /tests | |
parent | a6dd004113fcbc03ffacacc519d742ee84886c1d (diff) | |
download | rtic-d30bdcb096774c1f56d9823fb2fbb78bf5cd3584.tar.gz rtic-d30bdcb096774c1f56d9823fb2fbb78bf5cd3584.tar.zst rtic-d30bdcb096774c1f56d9823fb2fbb78bf5cd3584.zip |
safe `&'static mut` references via init.resources
Diffstat (limited to '')
-rw-r--r-- | tests/cfail/init-resource-share-idle.rs | 31 | ||||
-rw-r--r-- | tests/cfail/init-resource-share-task.rs | 36 |
2 files changed, 67 insertions, 0 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() {} |