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(|| {
|
2020-03-24 23:13:05 -05:00
|
|
|
//~^ 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(|| {
|
2018-02-10 23:01:49 -06:00
|
|
|
//~^ ERROR: E0277
|
2017-07-07 18:12:44 -05:00
|
|
|
drop(&a);
|
|
|
|
yield;
|
|
|
|
});
|
|
|
|
}
|