From 9865a7246df289bfa5f65ba47c883c4ce3e108a9 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sat, 9 Dec 2017 15:10:29 +0100 Subject: make resource proxies !Send --- macros/src/trans.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'macros') diff --git a/macros/src/trans.rs b/macros/src/trans.rs index 96631d5..77eada4 100644 --- a/macros/src/trans.rs +++ b/macros/src/trans.rs @@ -438,12 +438,14 @@ fn resources(app: &App, ownerships: &Ownerships, root: &mut Vec) { items.push(quote! { #[allow(non_camel_case_types)] - pub struct #name { _0: () } + pub struct #name { _0: PhantomData<*const ()> } + + unsafe impl Sync for #name {} #[allow(unsafe_code)] impl #name { pub unsafe fn new() -> Self { - #name { _0: () } + #name { _0: PhantomData } } } }); @@ -455,6 +457,8 @@ fn resources(app: &App, ownerships: &Ownerships, root: &mut Vec) { root.push(quote! { #[allow(unsafe_code)] mod _resource { + use core::marker::PhantomData; + #(#items)* } }) -- cgit v1.2.3