mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-27 14:04:56 +01:00
test RFC 147
This commit is contained in:
parent
d0aaa2a805
commit
d538f5b17c
5 changed files with 93 additions and 0 deletions
18
tests/cfail/unsafe-exception.rs
Normal file
18
tests/cfail/unsafe-exception.rs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#![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(_: init::Context) {}
|
||||||
|
|
||||||
|
#[exception(binds = SVCall)]
|
||||||
|
unsafe fn foo(_: foo::Context) {}
|
||||||
|
//~^ ERROR this `exception` handler must have type signature `fn(foo::Context)`
|
||||||
|
};
|
20
tests/cfail/unsafe-idle.rs
Normal file
20
tests/cfail/unsafe-idle.rs
Normal file
|
@ -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(_: init::Context) {}
|
||||||
|
|
||||||
|
#[idle]
|
||||||
|
unsafe fn idle(_: idle::Context) -> ! {
|
||||||
|
//~^ ERROR `idle` must have type signature `fn(idle::Context) -> !`
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
};
|
15
tests/cfail/unsafe-init.rs
Normal file
15
tests/cfail/unsafe-init.rs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#![no_main]
|
||||||
|
#![no_std]
|
||||||
|
|
||||||
|
extern crate lm3s6965;
|
||||||
|
extern crate panic_halt;
|
||||||
|
extern crate rtfm;
|
||||||
|
|
||||||
|
use rtfm::app;
|
||||||
|
|
||||||
|
#[app(device = lm3s6965)]
|
||||||
|
const APP: () = {
|
||||||
|
#[init]
|
||||||
|
unsafe fn init(_: init::Context) {}
|
||||||
|
//~^ ERROR `init` must have type signature `fn(init::Context) [-> init::LateResources]`
|
||||||
|
};
|
18
tests/cfail/unsafe-interrupt.rs
Normal file
18
tests/cfail/unsafe-interrupt.rs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#![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(_: init::Context) {}
|
||||||
|
|
||||||
|
#[interrupt(binds = UART0)]
|
||||||
|
unsafe fn foo(_: foo::Context) {}
|
||||||
|
//~^ ERROR this `interrupt` handler must have type signature `fn(foo::Context)`
|
||||||
|
};
|
22
tests/cfail/unsafe-task.rs
Normal file
22
tests/cfail/unsafe-task.rs
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
#![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(_: init::Context) {}
|
||||||
|
|
||||||
|
#[task]
|
||||||
|
unsafe fn foo(_: foo::Context) {}
|
||||||
|
//~^ ERROR this `task` handler must have type signature `fn(foo::Context, ..)`
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
fn UART0();
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in a new issue