]> git.proxmox.com Git - rustc.git/blame - src/test/ui/closures/2229_closure_analysis/capture-analysis-1.rs
New upstream version 1.55.0+dfsg1
[rustc.git] / src / test / ui / closures / 2229_closure_analysis / capture-analysis-1.rs
CommitLineData
136023e0
XL
1// edition:2021
2
5869c6ff
XL
3#![feature(rustc_attrs)]
4
5#[derive(Debug)]
6struct Point {
7 x: i32,
8 y: i32,
9}
10
11fn main() {
12 let p = Point { x: 10, y: 10 };
13 let q = Point { x: 10, y: 10 };
14
15 let c = #[rustc_capture_analysis]
16 //~^ ERROR: attributes on expressions are experimental
17 //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
18 || {
19 //~^ First Pass analysis includes:
20 //~| Min Capture analysis includes:
21 println!("{:?}", p);
22 //~^ NOTE: Capturing p[] -> ImmBorrow
23 //~| NOTE: Min Capture p[] -> ImmBorrow
24 println!("{:?}", p.x);
25 //~^ NOTE: Capturing p[(0, 0)] -> ImmBorrow
26
27 println!("{:?}", q.x);
28 //~^ NOTE: Capturing q[(0, 0)] -> ImmBorrow
29 println!("{:?}", q);
30 //~^ NOTE: Capturing q[] -> ImmBorrow
31 //~| NOTE: Min Capture q[] -> ImmBorrow
32 };
33}