]>
Commit | Line | Data |
---|---|---|
136023e0 XL |
1 | // edition:2021 |
2 | ||
5869c6ff XL |
3 | #![feature(rustc_attrs)] |
4 | ||
5 | #[derive(Debug)] | |
6 | struct Point { | |
7 | x: String, | |
8 | y: i32, | |
9 | } | |
10 | ||
11 | fn main() { | |
12 | let mut p = Point { x: String::new(), y: 10 }; | |
13 | ||
14 | let c = #[rustc_capture_analysis] | |
15 | //~^ ERROR: attributes on expressions are experimental | |
16 | //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> | |
17 | || { | |
18 | //~^ First Pass analysis includes: | |
19 | //~| Min Capture analysis includes: | |
20 | let _x = p.x; | |
21 | //~^ NOTE: Capturing p[(0, 0)] -> ByValue | |
22 | //~| NOTE: p[] captured as ByValue here | |
23 | println!("{:?}", p); | |
24 | //~^ NOTE: Capturing p[] -> ImmBorrow | |
25 | //~| NOTE: Min Capture p[] -> ByValue | |
26 | //~| NOTE: p[] used here | |
27 | }; | |
28 | } |