1 // compile-flags: -Zdrop-tracking
2 #![feature(generators, negative_impls, rustc_attrs)]
4 macro_rules! type_combinations {
6 $( $name:ident => { $( $tt:tt )* } );* $(;)?
11 impl !Sync for Client {}
12 impl !Send for Client {}
15 // Struct update syntax. This fails because the Client used in the update is considered
16 // dropped *after* the yield.
18 let g = move || match drop($name::Client { ..$name::Client::default() }) {
19 //~^ `significant_drop::Client` which is not `Send`
20 //~| `insignificant_dtor::Client` which is not `Send`
21 //~| `derived_drop::Client` which is not `Send`
25 //~^ ERROR cannot be sent between threads
26 //~| ERROR cannot be sent between threads
27 //~| ERROR cannot be sent between threads
30 // Simple owned value. This works because the Client is considered moved into `drop`,
31 // even though the temporary expression doesn't end until after the yield.
33 let g = move || match drop($name::Client::default()) {
41 fn assert_send<T: Send>(_thing: T) {}
46 copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
47 // NOT OK: MIR borrowck thinks that this is used after the yield, even though
48 // this has no `Drop` impl and only the drops of the fields are observable.
49 // FIXME: this should compile.
50 derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
55 impl Drop for Client {
59 // NOT OK (we need to agree with MIR borrowck)
60 insignificant_dtor => {
62 #[rustc_insignificant_dtor]
64 impl Drop for Client {