aboutsummaryrefslogtreecommitdiff
path: root/cortex-m-rt/tests/compile-fail/exception-nmi-unsafe.rs
blob: f5de2f8d196c255ae3b8696b1aca73983805c9f6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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`