From 2415a640af49666799bb4cd09a40f16853bdd687 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Mon, 2 Oct 2017 14:49:40 +0200 Subject: fix `idle::Resources::new` it assumed that all resources were "early" resources --- macros/src/trans.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'macros/src') diff --git a/macros/src/trans.rs b/macros/src/trans.rs index 45841e73..96ff770b 100644 --- a/macros/src/trans.rs +++ b/macros/src/trans.rs @@ -74,8 +74,14 @@ fn idle( }); let _name = Ident::new(format!("_{}", name.as_ref())); - rexprs.push(quote! { - #name: &mut #super_::#_name, + rexprs.push(if resource.expr.is_some() { + quote! { + #name: &mut #super_::#_name, + } + } else { + quote! { + #name: #super_::#_name.as_mut(), + } }); } else { rfields.push(quote! { -- cgit v1.2.3