rtic/tests/cfail/wrong-threshold.rs

56 lines
1.1 KiB
Rust
Raw Normal View History

#![deny(unsafe_code)]
2017-07-18 22:14:39 +02:00
#![deny(warnings)]
#![feature(proc_macro)]
2018-05-14 21:22:50 +02:00
#![no_main]
2017-07-24 03:51:58 +02:00
#![no_std]
2017-07-18 22:14:39 +02:00
extern crate cortex_m_rtfm as rtfm;
2018-05-07 17:46:26 +02:00
extern crate panic_itm;
2017-07-18 22:14:39 +02:00
extern crate stm32f103xx;
2018-05-01 14:01:51 +02:00
use rtfm::{app, Resource};
2017-07-18 22:14:39 +02:00
app! {
device: stm32f103xx,
resources: {
2017-07-24 03:51:58 +02:00
static A: u8 = 0;
static B: u8 = 0;
2017-07-18 22:14:39 +02:00
},
tasks: {
2018-05-01 14:01:51 +02:00
exti0: {
interrupt: EXTI0,
// priority: 1,
2017-07-18 22:14:39 +02:00
resources: [A, B],
},
2018-05-01 14:01:51 +02:00
exti1: {
interrupt: EXTI1,
2017-07-18 22:14:39 +02:00
priority: 2,
resources: [A, B],
},
},
}
2018-05-01 14:01:51 +02:00
fn init(_ctxt: init::Context) -> init::LateResources {
init::LateResources {}
}
2017-07-18 22:14:39 +02:00
2018-05-01 14:01:51 +02:00
fn idle(_ctxt: idle::Context) -> ! {
2017-07-18 22:14:39 +02:00
loop {}
}
2018-05-01 14:01:51 +02:00
fn exti0(mut ctxt: exti0::Context) {
2018-05-14 21:22:50 +02:00
let op = &mut ctxt.priority;
2018-05-01 14:01:51 +02:00
let exti0::Resources { A, B } = ctxt.resources;
2018-05-14 21:22:50 +02:00
A.claim(op, |_a, _ip| {
//~^ error closure requires unique access to `op` but `*op` is already borrowed
// ERROR must use inner token `_ip` instead of the outer one (`op`)
B.claim(op, |_b, _| {})
2017-07-18 22:14:39 +02:00
});
}
2018-05-01 14:01:51 +02:00
fn exti1(_ctxt: exti1::Context) {}