1 // This test enumerates various cases of interest where an ADT or tuple is
2 // partially initialized and then used in some way that is wrong *even*
3 // after rust-lang/rust#54987 is implemented.
5 // See rust-lang/rust#21232, rust-lang/rust#54986, and rust-lang/rust#54987.
7 // See issue-21232-partial-init-and-use.rs for cases of tests that are
8 // meant to compile and run successfully once rust-lang/rust#54987 is
23 fn drop(&mut self) { }
26 fn cannot_partially_init_adt_with_drop() {
28 d.x = 10; //~ ERROR E0381
31 fn cannot_partially_init_mutable_adt_with_drop() {
33 d.x = 10; //~ ERROR E0381
36 fn cannot_partially_reinit_adt_with_drop() {
37 let mut d = D { x: 0, s: S{ y: 0, z: 0 } };
40 //~^ ERROR assign of moved value: `d` [E0382]
43 fn cannot_partially_init_inner_adt_via_outer_with_drop() {
45 d.s.y = 20; //~ ERROR E0381
48 fn cannot_partially_init_inner_adt_via_mutable_outer_with_drop() {
50 d.s.y = 20; //~ ERROR E0381
53 fn cannot_partially_reinit_inner_adt_via_outer_with_drop() {
54 let mut d = D { x: 0, s: S{ y: 0, z: 0} };
57 //~^ ERROR assign to part of moved value: `d` [E0382]