]>
Commit | Line | Data |
---|---|---|
136023e0 | 1 | // edition:2021 |
fc512014 XL |
2 | // run-pass |
3 | ||
f2b60f7d | 4 | // Tests that if a closure uses individual fields of the same object |
fc512014 XL |
5 | // then that case is handled properly. |
6 | ||
7 | #![allow(unused)] | |
8 | ||
9 | struct Struct { | |
10 | x: i32, | |
11 | y: i32, | |
12 | s: String, | |
13 | } | |
14 | ||
15 | fn main() { | |
16 | let mut s = Struct { x: 10, y: 10, s: String::new() }; | |
17 | ||
18 | let mut c = { | |
19 | s.x += 10; | |
20 | s.y += 42; | |
21 | s.s = String::from("new"); | |
22 | }; | |
23 | } |