Skip to content
Snippets Groups Projects
Commit 271df39b authored by Jorge Aparicio's avatar Jorge Aparicio
Browse files

`Send`-ness check is now in rtfm-core

parent b9f50e43
No related branches found
No related tags found
No related merge requests found
...@@ -12,7 +12,6 @@ pub fn app(app: &App, ownerships: &Ownerships) -> Tokens { ...@@ -12,7 +12,6 @@ pub fn app(app: &App, ownerships: &Ownerships) -> Tokens {
let mut root = vec![]; let mut root = vec![];
let mut main = vec![]; let mut main = vec![];
::trans::check(app, &mut main);
::trans::init(app, &mut main, &mut root); ::trans::init(app, &mut main, &mut root);
::trans::idle(app, ownerships, &mut main, &mut root); ::trans::idle(app, ownerships, &mut main, &mut root);
::trans::resources(app, ownerships, &mut root); ::trans::resources(app, ownerships, &mut root);
...@@ -28,25 +27,6 @@ pub fn app(app: &App, ownerships: &Ownerships) -> Tokens { ...@@ -28,25 +27,6 @@ pub fn app(app: &App, ownerships: &Ownerships) -> Tokens {
quote!(#(#root)*) quote!(#(#root)*)
} }
// Checks that the resource types are valid
// Sadly we can't do this test at expansion time. Instead we'll generate some
// code that won't compile if the types don't meet the requirements
fn check(app: &App, main: &mut Vec<Tokens>) {
if !app.resources.is_empty() {
main.push(quote! {
fn is_send<T>() where T: Send {}
});
}
for resource in app.resources.values() {
let ty = &resource.ty;
main.push(quote! {
is_send::<#ty>();
});
}
}
fn idle( fn idle(
app: &App, app: &App,
ownerships: &Ownerships, ownerships: &Ownerships,
......
...@@ -14,7 +14,9 @@ app! { ...@@ -14,7 +14,9 @@ app! {
tasks: { tasks: {
// ERROR this interrupt doesn't exist // ERROR this interrupt doesn't exist
EXTI33: {}, EXTI33: {
path: exti33,
},
}, },
} }
...@@ -23,3 +25,5 @@ fn init(_p: init::Peripherals) {} ...@@ -23,3 +25,5 @@ fn init(_p: init::Peripherals) {}
fn idle() -> ! { fn idle() -> ! {
loop {} loop {}
} }
fn exti33() {}
...@@ -15,10 +15,13 @@ app! { //~ error bound `rtfm::Threshold: core::marker::Send` is not satisfied ...@@ -15,10 +15,13 @@ app! { //~ error bound `rtfm::Threshold: core::marker::Send` is not satisfied
static TOKEN: Option<Threshold> = None; static TOKEN: Option<Threshold> = None;
}, },
idle: {
resources: [TOKEN],
},
tasks: { tasks: {
EXTI0: { EXTI0: {
path: exti0, path: exti0,
priority: 1,
resources: [TOKEN], resources: [TOKEN],
}, },
} }
...@@ -26,7 +29,7 @@ app! { //~ error bound `rtfm::Threshold: core::marker::Send` is not satisfied ...@@ -26,7 +29,7 @@ app! { //~ error bound `rtfm::Threshold: core::marker::Send` is not satisfied
fn init(_p: init::Peripherals, _r: init::Resources) {} fn init(_p: init::Peripherals, _r: init::Resources) {}
fn idle() -> ! { fn idle(_t: &mut Threshold, _r: idle::Resources) -> ! {
loop {} loop {}
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment