mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-12 08:36:03 +00:00
15 lines
233 B
Rust
15 lines
233 B
Rust
|
//@ compile-flags: -O
|
||
|
//@ run-pass
|
||
|
|
||
|
struct Foo {
|
||
|
x: i32,
|
||
|
}
|
||
|
|
||
|
pub fn main() {
|
||
|
let mut foo = Foo { x: 42 };
|
||
|
let x = &mut foo.x;
|
||
|
*x = 13;
|
||
|
let y = foo;
|
||
|
assert_eq!(y.x, 13); // used to print 42 due to mir-opt bug
|
||
|
}
|