Skip to content

Commit

Permalink
Rollup merge of #75449 - RalfJung:const-prop-test, r=wesleywiser
Browse files Browse the repository at this point in the history
add regression test for #74739 (mir const-prop bug)

Fixes #74739
  • Loading branch information
JohnTitor authored Aug 13, 2020
2 parents 66157e2 + 0d6ff99 commit 845fb94
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/test/ui/issues/issue-74739.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,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
}

0 comments on commit 845fb94

Please sign in to comment.