blob: aa81a9fbbf9a9c9fe8e2548882d72e4c43168394 [file] [log] [blame]
//! Test that enums inherit Sync/!Sync properties from their variants.
//!
//! Uses the unstable `negative_impls` feature to explicitly opt-out of Sync.
#![feature(negative_impls)]
use std::marker::Sync;
struct NoSync;
impl !Sync for NoSync {}
enum Container {
WithNoSync(NoSync),
}
fn requires_sync<T: Sync>(_: T) {}
fn main() {
let container = Container::WithNoSync(NoSync);
requires_sync(container);
//~^ ERROR `NoSync` cannot be shared between threads safely [E0277]
}