3 // Test that we handle derferences properly when only some of the captures are being moved with
4 // `capture_disjoint_fields` enabled.
5 #![feature(rustc_attrs)]
7 #[derive(Debug, Default)]
9 struct MuchLargerType([SomeLargeType; 32]);
11 // Ensure that we don't capture any derefs when moving captures into the closures,
12 // i.e. only data from the enclosing stack is moved.
14 let s = MuchLargerType(Default::default());
18 let c = #[rustc_capture_analysis]
19 //~^ ERROR: attributes on expressions are experimental
20 //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
22 //~^ First Pass analysis includes:
23 //~| Min Capture analysis includes:
25 //~^ NOTE: Capturing t[(0, 0),Deref,(0, 0)] -> ByValue
26 //~| NOTE: Min Capture t[(0, 0)] -> ByValue
27 println!("{} {:?}", t.1, p);
28 //~^ NOTE: Capturing t[(1, 0)] -> ImmBorrow
29 //~| NOTE: Min Capture t[(1, 0)] -> ImmBorrow