2021-12-13 10:47:28 -08:00
|
|
|
#![feature(negative_impls, generators)]
|
|
|
|
|
|
|
|
struct Foo;
|
|
|
|
impl !Send for Foo {}
|
|
|
|
|
|
|
|
struct Bar {
|
|
|
|
foo: Foo,
|
|
|
|
x: i32,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
assert_send(|| {
|
2022-01-05 14:11:37 -08:00
|
|
|
//~^ ERROR generator cannot be sent between threads safely
|
|
|
|
// FIXME: it would be nice to make this work.
|
2021-12-13 10:47:28 -08:00
|
|
|
let guard = Bar { foo: Foo, x: 42 };
|
|
|
|
drop(guard.foo);
|
|
|
|
yield;
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
fn assert_send<T: Send>(_: T) {}
|