summaryrefslogtreecommitdiffstats
path: root/tests/ui/mir/issue-74739.rs
blob: 03622358ae1cd00ece3afc59383edccfed6fe0cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// 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
}