update compile-fail tests

This commit is contained in:
Jorge Aparicio 2019-04-21 20:20:15 +02:00
parent d2fb62f729
commit d0aaa2a805
35 changed files with 95 additions and 179 deletions

View file

@ -30,35 +30,35 @@ const APP: () = {
static S3: u32 = 0;
#[init(resources = [O1, O4, O5, O6, S3])]
fn init() {
resources.O1; //~ ERROR no field `O1`
resources.O4; //~ ERROR no field `O4`
resources.O5; //~ ERROR no field `O5`
resources.O6; //~ ERROR no field `O6`
resources.S3; //~ ERROR no field `S3`
fn init(c: init::Context) {
c.resources.O1; //~ ERROR no field `O1`
c.resources.O4; //~ ERROR no field `O4`
c.resources.O5; //~ ERROR no field `O5`
c.resources.O6; //~ ERROR no field `O6`
c.resources.S3; //~ ERROR no field `S3`
}
#[idle(resources = [O2, O4, S1, S3])]
fn idle() -> ! {
resources.O2; //~ ERROR no field `O2`
resources.O4; //~ ERROR no field `O4`
resources.S1; //~ ERROR no field `S1`
resources.S3; //~ ERROR no field `S3`
fn idle(c: idle::Context) -> ! {
c.resources.O2; //~ ERROR no field `O2`
c.resources.O4; //~ ERROR no field `O4`
c.resources.S1; //~ ERROR no field `S1`
c.resources.S3; //~ ERROR no field `S3`
loop {}
}
#[interrupt(resources = [O3, S1, S2, S3])]
fn UART0() {
resources.O3; //~ ERROR no field `O3`
resources.S1; //~ ERROR no field `S1`
resources.S2; //~ ERROR no field `S2`
resources.S3; //~ ERROR no field `S3`
fn UART0(c: UART0::Context) {
c.resources.O3; //~ ERROR no field `O3`
c.resources.S1; //~ ERROR no field `S1`
c.resources.S2; //~ ERROR no field `S2`
c.resources.S3; //~ ERROR no field `S3`
}
#[interrupt(resources = [S2, O5])]
fn UART1() {
resources.S2; //~ ERROR no field `S2`
resources.O5; //~ ERROR no field `O5`
fn UART1(c: UART1::Context) {
c.resources.S2; //~ ERROR no field `S2`
c.resources.O5; //~ ERROR no field `O5`
}
};

View file

@ -10,7 +10,7 @@ use rtfm::app;
#[app(device = lm3s6965)]
const APP: () = {
#[init]
fn init() {
fn init(_: init::Context) {
#[cfg(never)]
static mut FOO: u32 = 0;
@ -18,7 +18,7 @@ const APP: () = {
}
#[idle]
fn idle() -> ! {
fn idle(_: idle::Context) -> ! {
#[cfg(never)]
static mut FOO: u32 = 0;
@ -28,7 +28,7 @@ const APP: () = {
}
#[exception]
fn SVCall() {
fn SVCall(_: SVCall::Context) {
#[cfg(never)]
static mut FOO: u32 = 0;
@ -36,7 +36,7 @@ const APP: () = {
}
#[interrupt]
fn UART0() {
fn UART0(_: UART0::Context) {
#[cfg(never)]
static mut FOO: u32 = 0;
@ -44,7 +44,7 @@ const APP: () = {
}
#[task]
fn foo() {
fn foo(_: foo::Context) {
#[cfg(never)]
static mut FOO: u32 = 0;

View file

@ -10,13 +10,13 @@ use rtfm::app;
#[app(device = lm3s6965)]
const APP: () = {
#[init]
fn init() {}
fn init(_: init::Context) {}
#[task(
priority = 1,
priority = 2, //~ ERROR argument appears more than once
)]
fn foo() {}
fn foo(_: foo::Context) {}
extern "C" {
fn UART0();

View file

@ -10,13 +10,13 @@ use rtfm::app;
#[app(device = lm3s6965)]
const APP: () = {
#[init]
fn init() {}
fn init(_: init::Context) {}
#[task(
capacity = 1,
capacity = 2, //~ ERROR argument appears more than once
)]
fn foo() {}
fn foo(_: foo::Context) {}
extern "C" {
fn UART0();

View file

@ -1,29 +0,0 @@
#![no_main]
#![no_std]
extern crate lm3s6965;
extern crate panic_halt;
extern crate rtfm;
use rtfm::app;
#[app(device = lm3s6965)]
const APP: () = {
static mut UNINITIALIZED: bool = ();
#[init]
fn init() {
if false {
return; //~ ERROR `init` is *not* allowed to early return
}
UNINITIALIZED = true;
}
#[interrupt(resources = [UNINITIALIZED])]
fn UART0() {
if resources.UNINITIALIZED {
// UB
}
}
};

View file

@ -1,32 +0,0 @@
#![no_main]
#![no_std]
extern crate lm3s6965;
extern crate panic_halt;
extern crate rtfm;
use rtfm::app;
#[app(device = lm3s6965)]
const APP: () = {
static mut UNINITIALIZED: bool = ();
#[init]
fn init() {
let x = || {
// this is OK
return 0;
};
return; //~ ERROR `init` is *not* allowed to early return
UNINITIALIZED = true;
}
#[interrupt(resources = [UNINITIALIZED])]
fn UART0() {
if resources.UNINITIALIZED {
// UB
}
}
};

View file

@ -10,11 +10,11 @@ use rtfm::app;
#[app(device = lm3s6965)]
const APP: () = {
#[init]
fn init() {}
fn init(_: init::Context) {}
#[exception]
fn SVCall() -> ! {
//~^ ERROR `exception` handlers must have type signature `[unsafe] fn()`
fn SVCall(_: SVCall::Context) -> ! {
//~^ ERROR this `exception` handler must have type signature `fn(SVCall::Context)`
loop {}
}
};

View file

@ -10,10 +10,10 @@ use rtfm::app;
#[app(device = lm3s6965)]
const APP: () = {
#[init]
fn init() {}
fn init(_: init::Context) {}
#[exception]
fn SVCall(undef: u32) {
//~^ ERROR `exception` handlers must have type signature `[unsafe] fn()`
fn SVCall(_: SVCall::Context, undef: u32) {
//~^ ERROR this `exception` handler must have type signature `fn(SVCall::Context)`
}
};

View file

@ -10,10 +10,10 @@ use rtfm::app;
#[app(device = lm3s6965)]
const APP: () = {
#[init]
fn init() {}
fn init(_: init::Context) {}
#[exception]
fn NonMaskableInt() {
fn NonMaskableInt(_: NonMaskableInt::Context) {
//~^ ERROR only exceptions with configurable priority can be used as hardware tasks
}
};

View file

@ -10,11 +10,11 @@ use rtfm::app;
#[app(device = lm3s6965)]
const APP: () = {
#[init]
fn init() {}
fn init(_: init::Context) {}
#[exception]
fn SVCall() -> u32 {
//~^ ERROR `exception` handlers must have type signature `[unsafe] fn()`
fn SVCall(_: SVCall::Context) -> u32 {
//~^ ERROR this `exception` handler must have type signature `fn(SVCall::Context)`
0
}
};

View file

@ -10,10 +10,10 @@ use rtfm::app;
#[app(device = lm3s6965)]
const APP: () = {
#[init]
fn init() {}
fn init(_: init::Context) {}
#[exception]
fn SysTick() {
fn SysTick(_: SysTick::Context) {
//~^ ERROR the `SysTick` exception can't be used because it's used by the runtime
}
};

View file

@ -10,10 +10,10 @@ use rtfm::app;
#[app(device = lm3s6965)]
const APP: () = {
#[init]
fn init() {}
fn init(_: init::Context) {}
#[idle]
fn idle(undef: u32) {
//~^ ERROR `idle` must have type signature `[unsafe] fn() -> !`
fn idle(_: idle::Context, undef: u32) {
//~^ ERROR `idle` must have type signature `fn(idle::Context) -> !`
}
};

View file

@ -10,10 +10,10 @@ use rtfm::app;
#[app(device = lm3s6965)]
const APP: () = {
#[init]
fn init() {}
fn init(_: init::Context) {}
#[idle]
fn idle() {
//~^ ERROR `idle` must have type signature `[unsafe] fn() -> !`
fn idle(_: idle::Context) {
//~^ ERROR `idle` must have type signature `fn(idle::Context) -> !`
}
};

View file

@ -10,8 +10,8 @@ use rtfm::app;
#[app(device = lm3s6965)]
const APP: () = {
#[init]
fn init() -> ! {
//~^ ERROR `init` must have type signature `[unsafe] fn() [-> init::LateResources]`
fn init(_: init::Context) -> ! {
//~^ ERROR `init` must have type signature `fn(init::Context) [-> init::LateResources]`
loop {}
}
};

View file

@ -10,7 +10,7 @@ use rtfm::app;
#[app(device = lm3s6965)]
const APP: () = {
#[init]
fn init(undef: u32) {
//~^ ERROR `init` must have type signature `[unsafe] fn() [-> init::LateResources]`
fn init(_: init::Context, undef: u32) {
//~^ ERROR `init` must have type signature `fn(init::Context) [-> init::LateResources]`
}
};

View file

@ -1,6 +1,5 @@
//! This is equivalent to the `late-not-send` cfail test
#![feature(extern_crate_item_prelude)] // ???
#![no_main]
#![no_std]
@ -21,10 +20,10 @@ const APP: () = {
static mut X: Option<NotSend> = None;
#[init(resources = [X])]
fn init() {
*resources.X = Some(NotSend { _0: PhantomData })
fn init(c: init::Context) {
*c.resources.X = Some(NotSend { _0: PhantomData })
}
#[interrupt(resources = [X])]
fn UART0() {}
fn UART0(_: UART0::Context) {}
};

View file

@ -10,8 +10,8 @@ use rtfm::app;
#[app(device = lm3s6965)]
const APP: () = {
#[init]
fn init() -> u32 {
//~^ ERROR `init` must have type signature `[unsafe] fn() [-> init::LateResources]`
fn init(_: init::Context) -> u32 {
//~^ ERROR `init` must have type signature `fn(init::Context) [-> init::LateResources]`
0
}
};

View file

@ -10,8 +10,8 @@ use rtfm::app;
#[app(device = lm3s6965)] //~ ERROR 1 free interrupt (`extern { .. }`) is required
const APP: () = {
#[init]
fn init() {}
fn init(_: init::Context) {}
#[task]
fn foo() {}
fn foo(_: foo::Context) {}
};

View file

@ -10,11 +10,11 @@ use rtfm::app;
#[app(device = lm3s6965)]
const APP: () = {
#[init]
fn init() {}
fn init(_: init::Context) {}
#[interrupt]
fn UART0() -> ! {
//~^ ERROR `interrupt` handlers must have type signature `[unsafe] fn()`
fn UART0(_: UART0::Context) -> ! {
//~^ ERROR this `interrupt` handler must have type signature `fn(UART0::Context)`
loop {}
}
};

View file

@ -10,10 +10,10 @@ use rtfm::app;
#[app(device = lm3s6965)]
const APP: () = {
#[init]
fn init() {}
fn init(_: init::Context) {}
#[interrupt]
fn UART0(undef: u32) {
//~^ ERROR `interrupt` handlers must have type signature `[unsafe] fn()`
fn UART0(_: UART0::Context, undef: u32) {
//~^ ERROR this `interrupt` handler must have type signature `fn(UART0::Context)`
}
};

View file

@ -10,11 +10,11 @@ use rtfm::app;
#[app(device = lm3s6965)]
const APP: () = {
#[init]
fn init() {}
fn init(_: init::Context) {}
#[interrupt]
fn UART0() -> u32 {
//~^ ERROR `interrupt` handlers must have type signature `[unsafe] fn()`
fn UART0(_: UART0::Context) -> u32 {
//~^ ERROR this `interrupt` handler must have type signature `fn(UART0::Context)`
0
}
};

View file

@ -12,5 +12,5 @@ const APP: () = {
static mut X: u32 = ();
#[init(resources = [X])] //~ ERROR late resources can NOT be assigned to `init`
fn init() {}
fn init(_: init::Context) {}
};

View file

@ -1,7 +1,6 @@
//! `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]
@ -22,12 +21,12 @@ const APP: () = {
static mut X: NotSend = ();
#[init]
fn init() -> init::LateResources {
fn init(_: init::Context) -> init::LateResources {
init::LateResources {
X: NotSend { _0: PhantomData },
}
}
#[interrupt(resources = [X])]
fn UART0() {}
fn UART0(_: UART0::Context) {}
};

View file

@ -1,18 +0,0 @@
// TODO remove in v0.5.x
#![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() {}
};

View file

@ -1,4 +1,3 @@
#![feature(extern_crate_item_prelude)] // ???
#![no_main]
#![no_std]
@ -19,10 +18,10 @@ unsafe impl Sync for NotSend {}
#[app(device = lm3s6965)] //~ ERROR cannot be sent between threads safely
const APP: () = {
#[init(spawn = [foo])]
fn init() {}
fn init(_: init::Context) {}
#[task]
fn foo(_x: NotSend) {}
fn foo(_: foo::Context, _x: NotSend) {}
extern "C" {
fn UART0();

View file

@ -1,4 +1,3 @@
#![feature(extern_crate_item_prelude)] // ???
#![no_main]
#![no_std]
@ -21,13 +20,13 @@ const APP: () = {
static X: NotSync = NotSync { _0: PhantomData };
#[init(spawn = [foo])]
fn init() {}
fn init(_: init::Context) {}
#[task(priority = 1, resources = [X])]
fn foo() {}
fn foo(_: foo::Context) {}
#[task(priority = 2, resources = [X])]
fn bar() {}
fn bar(_: bar::Context) {}
extern "C" {
fn UART0();

View file

@ -10,13 +10,13 @@ use rtfm::app;
#[app(device = lm3s6965)] //~ error evaluation of constant value failed
const APP: () = {
#[init]
fn init() {}
fn init(_: init::Context) {}
// OK, this is the maximum priority supported by the device
#[interrupt(priority = 8)]
fn UART0() {}
fn UART0(_: UART0::Context) {}
// this value is too high!
#[interrupt(priority = 9)]
fn UART1() {}
fn UART1(_: UART1::Context) {}
};

View file

@ -10,13 +10,13 @@ use rtfm::app;
#[app(device = lm3s6965)]
const APP: () = {
#[init]
fn init() {}
fn init(_: init::Context) {}
// OK, this is the minimum priority that tasks can have
#[interrupt(priority = 1)]
fn UART0() {}
fn UART0(_: UART0::Context) {}
// this value is too low!
#[interrupt(priority = 0)] //~ error this literal must be in the range 1...255
fn UART1() {}
fn UART1(_: UART1::Context) {}
};

View file

@ -10,5 +10,5 @@ use rtfm::app;
#[app(device = lm3s6965)]
const APP: () = {
#[init(resources = [X])] //~ ERROR this resource has NOT been declared
fn init() {}
fn init(_: init::Context) {}
};

View file

@ -13,5 +13,5 @@ const APP: () = {
//~^ ERROR resources must have inherited / private visibility
#[init]
fn init() {}
fn init(_: init::Context) {}
};

View file

@ -5,16 +5,14 @@ extern crate lm3s6965;
extern crate panic_halt;
extern crate rtfm;
use rtfm::app;
#[app(device = lm3s6965)]
#[rtfm::app(device = lm3s6965)]
const APP: () = {
#[init]
fn init() {}
fn init(_: init::Context) {}
#[task]
fn foo() -> ! {
//~^ ERROR `task` handlers must have type signature `[unsafe] fn(..)`
fn foo(_: foo::Context) -> ! {
//~^ ERROR this `task` handler must have type signature `fn(foo::Context, ..)`
loop {}
}

View file

@ -10,10 +10,10 @@ use rtfm::app;
#[app(device = lm3s6965)]
const APP: () = {
#[init]
fn init() {}
fn init(_: init::Context) {}
#[task]
fn idle() {
fn idle(_: idle::Context) {
//~^ ERROR `task` handlers can NOT be named `idle`, `init` or `resources`
}

View file

@ -10,5 +10,5 @@ use rtfm::app;
#[app(device = lm3s6965)]
const APP: () = {
#[init(spawn = [X])] //~ ERROR this task has NOT been declared
fn init() {}
fn init(_: init::Context) {}
};

View file

@ -10,10 +10,10 @@ use rtfm::app;
#[app(device = lm3s6965)]
const APP: () = {
#[init]
fn init() {}
fn init(_: init::Context) {}
#[interrupt(binds = UART0)] //~ ERROR free interrupts (`extern { .. }`) can't be used as interrupt handlers
fn foo() {}
fn foo(_: foo::Context) {}
extern "C" {
fn UART0();

View file

@ -10,10 +10,11 @@ use rtfm::app;
#[app(device = lm3s6965)]
const APP: () = {
#[init]
fn init() {}
fn init(_: init::Context) {}
#[interrupt]
fn UART0() {} //~ ERROR free interrupts (`extern { .. }`) can't be used as interrupt handlers
fn UART0(_: UART0::Context) {}
//~^ ERROR free interrupts (`extern { .. }`) can't be used as interrupt handlers
extern "C" {
fn UART0();