rust/tests/ui/no_share-struct.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

15 lines
247 B
Rust
Raw Normal View History

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