rust/src/test/ui/no_share-enum.rs

17 lines
276 B
Rust
Raw Normal View History

2015-01-11 13:14:39 +01:00
#![feature(optin_builtin_traits)]
2015-01-11 13:14:39 +01:00
use std::marker::Sync;
struct NoSync;
impl !Sync for NoSync {}
enum Foo { A(NoSync) }
fn bar<T: Sync>(_: T) {}
fn main() {
2015-01-11 13:14:39 +01:00
let x = Foo::A(NoSync);
2014-02-05 16:33:10 -06:00
bar(x);
//~^ ERROR `NoSync` cannot be shared between threads safely [E0277]
}