blob: aa81a9fbbf9a9c9fe8e2548882d72e4c43168394 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
//! 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]
}
|