From 62c5c1ae431790e36ffeb0eebba75dfabb5dbd76 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sat, 9 Dec 2017 16:13:22 +0100 Subject: [PATCH] make resource proxies not Sync --- macros/src/trans.rs | 2 -- .../cfail/{resource-not-send.rs => resource-not-send-sync.rs} | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) rename tests/cfail/{resource-not-send.rs => resource-not-send-sync.rs} (87%) diff --git a/macros/src/trans.rs b/macros/src/trans.rs index 77eada4153..9bf1e2a9dc 100644 --- a/macros/src/trans.rs +++ b/macros/src/trans.rs @@ -440,8 +440,6 @@ fn resources(app: &App, ownerships: &Ownerships, root: &mut Vec) { #[allow(non_camel_case_types)] pub struct #name { _0: PhantomData<*const ()> } - unsafe impl Sync for #name {} - #[allow(unsafe_code)] impl #name { pub unsafe fn new() -> Self { diff --git a/tests/cfail/resource-not-send.rs b/tests/cfail/resource-not-send-sync.rs similarity index 87% rename from tests/cfail/resource-not-send.rs rename to tests/cfail/resource-not-send-sync.rs index c89c3d31cc..775c78ae07 100644 --- a/tests/cfail/resource-not-send.rs +++ b/tests/cfail/resource-not-send-sync.rs @@ -41,8 +41,9 @@ fn is_send(_: &T) where T: Send {} fn is_sync(_: &T) where T: Sync {} fn exti0(_t: &mut Threshold, r: EXTI0::Resources) { - // OK + // ERROR resource proxies can't be shared between tasks is_sync(&r.SHARED); + //~^ error the trait bound `*const (): core::marker::Sync` is not satisfied // ERROR resource proxies are not `Send`able across tasks is_send(&r.SHARED);