rust/tests/ui/generator/partial-drop.rs
Camille GILLOT 211d2ed07b Bless tests.
2023-09-23 13:47:30 +00:00

35 lines
595 B
Rust

// check-pass
#![feature(negative_impls, generators)]
struct Foo;
impl !Send for Foo {}
struct Bar {
foo: Foo,
x: i32,
}
fn main() {
assert_send(|| {
let guard = Bar { foo: Foo, x: 42 };
drop(guard.foo);
yield;
});
assert_send(|| {
let mut guard = Bar { foo: Foo, x: 42 };
drop(guard);
guard = Bar { foo: Foo, x: 23 };
yield;
});
assert_send(|| {
let guard = Bar { foo: Foo, x: 42 };
let Bar { foo, x } = guard;
drop(foo);
yield;
});
}
fn assert_send<T: Send>(_: T) {}