diff options
author | 2020-08-23 22:16:07 +0000 | |
---|---|---|
committer | 2020-08-23 22:16:07 +0000 | |
commit | f4a85dcc92e90e27588cbe14e0447b89f672e30f (patch) | |
tree | 4af03e376f2c48f35109f3da21c5e96354975b4d /cortex-m-rt/tests/compile-fail/exception-nmi-unsafe.rs | |
parent | cbb3c4e63079a2a70b09f8038606b1c51f34675d (diff) | |
parent | bb868f4a90c6eff142801bc1a19b135483eed312 (diff) | |
download | cortex-m-f4a85dcc92e90e27588cbe14e0447b89f672e30f.tar.gz cortex-m-f4a85dcc92e90e27588cbe14e0447b89f672e30f.tar.zst cortex-m-f4a85dcc92e90e27588cbe14e0447b89f672e30f.zip |
Merge #289
289: Make it unsafe to define NMI handlers r=therealprof a=jonas-schievink
Reverts https://github.com/rust-embedded/cortex-m-rt/pull/257
Fixes https://github.com/rust-embedded/cortex-m-rt/issues/269
Fixes https://github.com/rust-embedded/cortex-m/issues/196 (see that thread for details)
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Diffstat (limited to 'cortex-m-rt/tests/compile-fail/exception-nmi-unsafe.rs')
-rw-r--r-- | cortex-m-rt/tests/compile-fail/exception-nmi-unsafe.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/cortex-m-rt/tests/compile-fail/exception-nmi-unsafe.rs b/cortex-m-rt/tests/compile-fail/exception-nmi-unsafe.rs new file mode 100644 index 0000000..f5de2f8 --- /dev/null +++ b/cortex-m-rt/tests/compile-fail/exception-nmi-unsafe.rs @@ -0,0 +1,24 @@ +#![no_main] +#![no_std] + +extern crate cortex_m_rt; +extern crate panic_halt; + +use cortex_m_rt::{entry, exception}; + +#[entry] +fn foo() -> ! { + loop {} +} + +#[exception] +fn DefaultHandler(_irq: i16) {} +//~^ ERROR defining a `DefaultHandler` is unsafe and requires an `unsafe fn` + +#[exception] +fn HardFault() {} +//~^ ERROR defining a `HardFault` handler is unsafe and requires an `unsafe fn` + +#[exception] +fn NonMaskableInt() {} +//~^ ERROR defining a `NonMaskableInt` handler is unsafe and requires an `unsafe fn` |