1 // Verify that UnsafeCell is *always* !Sync regardless if `T` is sync.
3 #![feature(negative_impls)]
5 use std::cell::UnsafeCell;
13 impl !Sync for NoSync {}
15 fn test<T: Sync>(s: T) {}
18 let us = UnsafeCell::new(MySync{u: UnsafeCell::new(0)});
20 //~^ ERROR `UnsafeCell<MySync<{integer}>>` cannot be shared between threads safely
22 let uns = UnsafeCell::new(NoSync);
24 //~^ ERROR `UnsafeCell<NoSync>` cannot be shared between threads safely [E0277]
26 let ms = MySync{u: uns};
28 //~^ ERROR `UnsafeCell<NoSync>` cannot be shared between threads safely [E0277]
31 //~^ ERROR `NoSync` cannot be shared between threads safely [E0277]