3 // Tests that in cases where we individually capture all the fields of a type,
4 // we still drop them in the order they would have been dropped in the 2018 edition.
6 // NOTE: It is *critical* that the order of the min capture NOTES in the stderr output
9 #![feature(rustc_attrs)]
13 impl Drop for HasDrop {
20 let a = (HasDrop, HasDrop);
21 let b = (HasDrop, HasDrop);
23 let c = #[rustc_capture_analysis]
24 //~^ ERROR: attributes on expressions are experimental
25 //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
27 //~^ ERROR: Min Capture analysis includes:
29 println!("{:?}", a.0);
30 //~^ NOTE: Min Capture a[(0, 0)] -> ImmBorrow
32 println!("{:?}", a.1);
33 //~^ NOTE: Min Capture a[(1, 0)] -> ImmBorrow
36 println!("{:?}", b.0);
37 //~^ NOTE: Min Capture b[(0, 0)] -> ImmBorrow
39 println!("{:?}", b.1);
40 //~^ NOTE: Min Capture b[(1, 0)] -> ImmBorrow
46 let a = (HasDrop, HasDrop);
47 let b = (HasDrop, HasDrop);
49 let c = #[rustc_capture_analysis]
50 //~^ ERROR: attributes on expressions are experimental
51 //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
53 //~^ ERROR: Min Capture analysis includes:
55 println!("{:?}", a.1);
56 //~^ NOTE: Min Capture a[(1, 0)] -> ImmBorrow
58 println!("{:?}", a.0);
59 //~^ NOTE: Min Capture a[(0, 0)] -> ImmBorrow
62 println!("{:?}", b.1);
63 //~^ NOTE: Min Capture b[(1, 0)] -> ImmBorrow
65 println!("{:?}", b.0);
66 //~^ NOTE: Min Capture b[(0, 0)] -> ImmBorrow
72 let a = (HasDrop, HasDrop);
73 let b = (HasDrop, HasDrop);
75 let c = #[rustc_capture_analysis]
76 //~^ ERROR: attributes on expressions are experimental
77 //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
79 //~^ ERROR: Min Capture analysis includes:
81 println!("{:?}", b.1);
82 //~^ NOTE: Min Capture b[(1, 0)] -> ImmBorrow
84 println!("{:?}", a.1);
85 //~^ NOTE: Min Capture a[(1, 0)] -> ImmBorrow
87 println!("{:?}", a.0);
88 //~^ NOTE: Min Capture a[(0, 0)] -> ImmBorrow
91 println!("{:?}", b.0);
92 //~^ NOTE: Min Capture b[(0, 0)] -> ImmBorrow