]> git.proxmox.com Git - rustc.git/blob - src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-3.rs
New upstream version 1.55.0+dfsg1
[rustc.git] / src / test / ui / closures / 2229_closure_analysis / run_pass / multilevel-path-3.rs
1 // edition:2021
2 // run-pass
3
4 #![allow(unused)]
5
6 // Test that when `capture_disjoint_fields` is enabled we can read a path
7 // both inside and outside the closure at the same time.
8
9 struct Point {
10 x: i32,
11 y: i32,
12 }
13 struct Wrapper {
14 p: Point,
15 }
16
17 fn main() {
18 let mut w = Wrapper { p: Point { x: 10, y: 10 } };
19
20 let c = || {
21 println!("{}", w.p.x);
22 };
23
24 let px = &w.p.x;
25 c();
26
27 println!("{}", px);
28 }