3 #![feature(rustc_attrs)]
15 let mut w = Wrapper { p: Point { x: 10, y: 10 } };
17 // Only paths that appears within the closure that directly start off
18 // a variable defined outside the closure are captured.
20 // Therefore `w.p` is captured
21 // Note that `wp.x` doesn't start off a variable defined outside the closure.
22 let c = #[rustc_capture_analysis]
23 //~^ ERROR: attributes on expressions are experimental
24 //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
26 //~^ ERROR: First Pass analysis includes:
27 //~| ERROR: Min Capture analysis includes:
29 //~^ NOTE: Capturing w[(0, 0)] -> ImmBorrow
30 //~| NOTE: Min Capture w[(0, 0)] -> ImmBorrow
34 // Since `c` captures `w.p` by an ImmBorrow, `w.p.y` can't be mutated.