generate resource proxies only when needed

only `static mut` resources need proxies
This commit is contained in:
Jorge Aparicio 2019-05-09 18:25:34 +02:00
parent bc024f1979
commit 36073a6342

View file

@ -234,6 +234,8 @@ fn resources(
)); ));
} }
// generate a resource proxy when needed
if res.mutability.is_some() {
if let Some(Ownership::Shared { ceiling }) = analysis.ownerships.get(name) { if let Some(Ownership::Shared { ceiling }) = analysis.ownerships.get(name) {
let ptr = if res.expr.is_none() { let ptr = if res.expr.is_none() {
quote!(#name.as_mut_ptr()) quote!(#name.as_mut_ptr())
@ -270,6 +272,7 @@ fn resources(
)); ));
} }
} }
}
let mod_resources = if mod_resources.is_empty() { let mod_resources = if mod_resources.is_empty() {
quote!() quote!()