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