summaryrefslogtreecommitdiff
path: root/macros/src/trans.rs
diff options
context:
space:
mode:
authorGravatar Jorge Aparicio <jorge@japaric.io> 2017-07-26 17:01:53 -0500
committerGravatar Jorge Aparicio <jorge@japaric.io> 2017-07-26 17:01:53 -0500
commit4a1509cb53d9b8a33c17264fa54cca8886788073 (patch)
tree6249d0306d38545ac121ded5d9030b4e503ca867 /macros/src/trans.rs
parent6a2ff0aede787d0d6f2ac55e30fb1a248881155d (diff)
downloadrtic-4a1509cb53d9b8a33c17264fa54cca8886788073.tar.gz
rtic-4a1509cb53d9b8a33c17264fa54cca8886788073.tar.zst
rtic-4a1509cb53d9b8a33c17264fa54cca8886788073.zip
fix around owned idle resource
Diffstat (limited to '')
-rw-r--r--macros/src/trans.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/macros/src/trans.rs b/macros/src/trans.rs
index 39c9c6f5..6554dc9f 100644
--- a/macros/src/trans.rs
+++ b/macros/src/trans.rs
@@ -28,6 +28,9 @@ pub fn app(app: &App, ownerships: &Ownerships) -> Tokens {
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! {
@@ -95,8 +98,9 @@ fn idle(
pub #name: &'static mut #ty,
});
+ let _name = Ident::new(format!("_{}", name.as_ref()));
rexprs.push(quote! {
- #name: &mut #super_::#name,
+ #name: &mut #super_::#_name,
});
} else {
rfields.push(quote! {