]> git.proxmox.com Git - rustc.git/blame - src/test/ui/closures/2229_closure_analysis/capture-analysis-4.rs
New upstream version 1.55.0+dfsg1
[rustc.git] / src / test / ui / closures / 2229_closure_analysis / capture-analysis-4.rs
CommitLineData
136023e0
XL
1// edition:2021
2
5869c6ff
XL
3#![feature(rustc_attrs)]
4
5#[derive(Debug)]
6struct Child {
7 c: String,
8 d: String,
9}
10
11#[derive(Debug)]
12struct Parent {
13 b: Child,
14}
15
16fn 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;
26 //~^ NOTE: Capturing a[(0, 0)] -> ByValue
27 //~| NOTE: Min Capture a[(0, 0)] -> ByValue
28 println!("{:?}", a.b.c);
29 //~^ NOTE: Capturing a[(0, 0),(0, 0)] -> ImmBorrow
30 };
31}