2021-06-27 01:22:46 -05:00
|
|
|
// edition:2021
|
2020-11-25 14:15:55 -06:00
|
|
|
// run-pass
|
|
|
|
|
2022-08-17 21:13:37 -05:00
|
|
|
// Tests that if a closure uses individual fields of the same object
|
2020-11-25 14:15:55 -06:00
|
|
|
// then that case is handled properly.
|
|
|
|
|
|
|
|
#![allow(unused)]
|
|
|
|
|
|
|
|
struct Struct {
|
|
|
|
x: i32,
|
|
|
|
y: i32,
|
|
|
|
s: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut s = Struct { x: 10, y: 10, s: String::new() };
|
|
|
|
|
|
|
|
let mut c = {
|
|
|
|
s.x += 10;
|
|
|
|
s.y += 42;
|
|
|
|
s.s = String::from("new");
|
|
|
|
};
|
|
|
|
}
|