]> git.proxmox.com Git - rustc.git/blob - src/test/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.rs
New upstream version 1.67.1+dfsg1
[rustc.git] / src / test / ui / closures / 2229_closure_analysis / capture-disjoint-field-tuple.rs
1 // edition:2021
2
3 #![feature(rustc_attrs)]
4
5 fn main() {
6 let mut t = (10, 10);
7
8 let c = #[rustc_capture_analysis]
9 //~^ ERROR: attributes on expressions are experimental
10 //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
11 || {
12 //~^ First Pass analysis includes:
13 //~| Min Capture analysis includes:
14 println!("{}", t.0);
15 //~^ NOTE: Capturing t[(0, 0)] -> ImmBorrow
16 //~| NOTE: Min Capture t[(0, 0)] -> ImmBorrow
17 };
18
19 // `c` only captures t.0, therefore mutating t.1 is allowed.
20 let t1 = &mut t.1;
21
22 c();
23 *t1 = 20;
24 }