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