fix around owned idle resource

This commit is contained in:
Jorge Aparicio 2017-07-26 17:01:53 -05:00
parent 6a2ff0aede
commit 4a1509cb53

View file

@ -28,6 +28,9 @@ 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>) { fn check(app: &App, main: &mut Vec<Tokens>) {
if !app.resources.is_empty() { if !app.resources.is_empty() {
main.push(quote! { main.push(quote! {
@ -95,8 +98,9 @@ fn idle(
pub #name: &'static mut #ty, pub #name: &'static mut #ty,
}); });
let _name = Ident::new(format!("_{}", name.as_ref()));
rexprs.push(quote! { rexprs.push(quote! {
#name: &mut #super_::#name, #name: &mut #super_::#_name,
}); });
} else { } else {
rfields.push(quote! { rfields.push(quote! {