rust/tests/ui/generator/not-send-sync.rs

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

22 lines
395 B
Rust
Raw Normal View History

2017-07-20 01:07:58 -05:00
#![feature(generators)]
2017-07-07 18:12:44 -05:00
use std::cell::Cell;
fn main() {
fn assert_sync<T: Sync>(_: T) {}
fn assert_send<T: Send>(_: T) {}
assert_sync(|| {
//~^ ERROR: generator cannot be shared between threads safely
2017-07-07 18:12:44 -05:00
let a = Cell::new(2);
yield;
});
let a = Cell::new(2);
assert_send(|| {
//~^ ERROR: E0277
2017-07-07 18:12:44 -05:00
drop(&a);
yield;
});
}