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; static S3: u32 = 0;
#[init(resources = [O1, O4, O5, O6, S3])] #[init(resources = [O1, O4, O5, O6, S3])]
fn init() { fn init(c: init::Context) {
resources.O1; //~ ERROR no field `O1` c.resources.O1; //~ ERROR no field `O1`
resources.O4; //~ ERROR no field `O4` c.resources.O4; //~ ERROR no field `O4`
resources.O5; //~ ERROR no field `O5` c.resources.O5; //~ ERROR no field `O5`
resources.O6; //~ ERROR no field `O6` c.resources.O6; //~ ERROR no field `O6`
resources.S3; //~ ERROR no field `S3` c.resources.S3; //~ ERROR no field `S3`
} }
#[idle(resources = [O2, O4, S1, S3])] #[idle(resources = [O2, O4, S1, S3])]
fn idle() -> ! { fn idle(c: idle::Context) -> ! {
resources.O2; //~ ERROR no field `O2` c.resources.O2; //~ ERROR no field `O2`
resources.O4; //~ ERROR no field `O4` c.resources.O4; //~ ERROR no field `O4`
resources.S1; //~ ERROR no field `S1` c.resources.S1; //~ ERROR no field `S1`
resources.S3; //~ ERROR no field `S3` c.resources.S3; //~ ERROR no field `S3`
loop {} loop {}
} }
#[interrupt(resources = [O3, S1, S2, S3])] #[interrupt(resources = [O3, S1, S2, S3])]
fn UART0() { fn UART0(c: UART0::Context) {
resources.O3; //~ ERROR no field `O3` c.resources.O3; //~ ERROR no field `O3`
resources.S1; //~ ERROR no field `S1` c.resources.S1; //~ ERROR no field `S1`
resources.S2; //~ ERROR no field `S2` c.resources.S2; //~ ERROR no field `S2`
resources.S3; //~ ERROR no field `S3` c.resources.S3; //~ ERROR no field `S3`
} }
#[interrupt(resources = [S2, O5])] #[interrupt(resources = [S2, O5])]
fn UART1() { fn UART1(c: UART1::Context) {
resources.S2; //~ ERROR no field `S2` c.resources.S2; //~ ERROR no field `S2`
resources.O5; //~ ERROR no field `O5` c.resources.O5; //~ ERROR no field `O5`
} }
}; };

View file

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

View file

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

View file

@ -10,13 +10,13 @@ use rtfm::app;
#[app(device = lm3s6965)] #[app(device = lm3s6965)]
const APP: () = { const APP: () = {
#[init] #[init]
fn init() {} fn init(_: init::Context) {}
#[task( #[task(
capacity = 1, capacity = 1,
capacity = 2, //~ ERROR argument appears more than once capacity = 2, //~ ERROR argument appears more than once
)] )]
fn foo() {} fn foo(_: foo::Context) {}
extern "C" { extern "C" {
fn UART0(); 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)] #[app(device = lm3s6965)]
const APP: () = { const APP: () = {
#[init] #[init]
fn init() {} fn init(_: init::Context) {}
#[exception] #[exception]
fn SVCall() -> ! { fn SVCall(_: SVCall::Context) -> ! {
//~^ ERROR `exception` handlers must have type signature `[unsafe] fn()` //~^ ERROR this `exception` handler must have type signature `fn(SVCall::Context)`
loop {} loop {}
} }
}; };

View file

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

View file

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

View file

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

View file

@ -10,10 +10,10 @@ use rtfm::app;
#[app(device = lm3s6965)] #[app(device = lm3s6965)]
const APP: () = { const APP: () = {
#[init] #[init]
fn init() {} fn init(_: init::Context) {}
#[exception] #[exception]
fn SysTick() { fn SysTick(_: SysTick::Context) {
//~^ ERROR the `SysTick` exception can't be used because it's used by the runtime //~^ 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)] #[app(device = lm3s6965)]
const APP: () = { const APP: () = {
#[init] #[init]
fn init() {} fn init(_: init::Context) {}
#[idle] #[idle]
fn idle(undef: u32) { fn idle(_: idle::Context, undef: u32) {
//~^ ERROR `idle` must have type signature `[unsafe] fn() -> !` //~^ ERROR `idle` must have type signature `fn(idle::Context) -> !`
} }
}; };

View file

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

View file

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

View file

@ -10,7 +10,7 @@ use rtfm::app;
#[app(device = lm3s6965)] #[app(device = lm3s6965)]
const APP: () = { const APP: () = {
#[init] #[init]
fn init(undef: u32) { fn init(_: init::Context, undef: u32) {
//~^ ERROR `init` must have type signature `[unsafe] fn() [-> init::LateResources]` //~^ 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 //! This is equivalent to the `late-not-send` cfail test
#![feature(extern_crate_item_prelude)] // ???
#![no_main] #![no_main]
#![no_std] #![no_std]
@ -21,10 +20,10 @@ const APP: () = {
static mut X: Option<NotSend> = None; static mut X: Option<NotSend> = None;
#[init(resources = [X])] #[init(resources = [X])]
fn init() { fn init(c: init::Context) {
*resources.X = Some(NotSend { _0: PhantomData }) *c.resources.X = Some(NotSend { _0: PhantomData })
} }
#[interrupt(resources = [X])] #[interrupt(resources = [X])]
fn UART0() {} fn UART0(_: UART0::Context) {}
}; };

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -12,5 +12,5 @@ const APP: () = {
static mut X: u32 = (); static mut X: u32 = ();
#[init(resources = [X])] //~ ERROR late resources can NOT be assigned to `init` #[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 //! `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 //! message to the task that will own the resource
#![feature(extern_crate_item_prelude)] // ???
#![no_main] #![no_main]
#![no_std] #![no_std]
@ -22,12 +21,12 @@ const APP: () = {
static mut X: NotSend = (); static mut X: NotSend = ();
#[init] #[init]
fn init() -> init::LateResources { fn init(_: init::Context) -> init::LateResources {
init::LateResources { init::LateResources {
X: NotSend { _0: PhantomData }, X: NotSend { _0: PhantomData },
} }
} }
#[interrupt(resources = [X])] #[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_main]
#![no_std] #![no_std]
@ -19,10 +18,10 @@ unsafe impl Sync for NotSend {}
#[app(device = lm3s6965)] //~ ERROR cannot be sent between threads safely #[app(device = lm3s6965)] //~ ERROR cannot be sent between threads safely
const APP: () = { const APP: () = {
#[init(spawn = [foo])] #[init(spawn = [foo])]
fn init() {} fn init(_: init::Context) {}
#[task] #[task]
fn foo(_x: NotSend) {} fn foo(_: foo::Context, _x: NotSend) {}
extern "C" { extern "C" {
fn UART0(); fn UART0();

View file

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

View file

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

View file

@ -10,13 +10,13 @@ use rtfm::app;
#[app(device = lm3s6965)] #[app(device = lm3s6965)]
const APP: () = { const APP: () = {
#[init] #[init]
fn init() {} fn init(_: init::Context) {}
// OK, this is the minimum priority that tasks can have // OK, this is the minimum priority that tasks can have
#[interrupt(priority = 1)] #[interrupt(priority = 1)]
fn UART0() {} fn UART0(_: UART0::Context) {}
// this value is too low! // this value is too low!
#[interrupt(priority = 0)] //~ error this literal must be in the range 1...255 #[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)] #[app(device = lm3s6965)]
const APP: () = { const APP: () = {
#[init(resources = [X])] //~ ERROR this resource has NOT been declared #[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 //~^ ERROR resources must have inherited / private visibility
#[init] #[init]
fn init() {} fn init(_: init::Context) {}
}; };

View file

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

View file

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

View file

@ -10,5 +10,5 @@ use rtfm::app;
#[app(device = lm3s6965)] #[app(device = lm3s6965)]
const APP: () = { const APP: () = {
#[init(spawn = [X])] //~ ERROR this task has NOT been declared #[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)] #[app(device = lm3s6965)]
const APP: () = { const APP: () = {
#[init] #[init]
fn init() {} fn init(_: init::Context) {}
#[interrupt(binds = UART0)] //~ ERROR free interrupts (`extern { .. }`) can't be used as interrupt handlers #[interrupt(binds = UART0)] //~ ERROR free interrupts (`extern { .. }`) can't be used as interrupt handlers
fn foo() {} fn foo(_: foo::Context) {}
extern "C" { extern "C" {
fn UART0(); fn UART0();

View file

@ -10,10 +10,11 @@ use rtfm::app;
#[app(device = lm3s6965)] #[app(device = lm3s6965)]
const APP: () = { const APP: () = {
#[init] #[init]
fn init() {} fn init(_: init::Context) {}
#[interrupt] #[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" { extern "C" {
fn UART0(); fn UART0();