Skip to content

Commit 845fb94

Browse files
authored
Rollup merge of #75449 - RalfJung:const-prop-test, r=wesleywiser
add regression test for #74739 (mir const-prop bug) Fixes #74739
2 parents 66157e2 + 0d6ff99 commit 845fb94

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/test/ui/issues/issue-74739.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// compile-flags: -O
2+
// run-pass
3+
4+
struct Foo {
5+
x: i32,
6+
}
7+
8+
pub fn main() {
9+
let mut foo = Foo { x: 42 };
10+
let x = &mut foo.x;
11+
*x = 13;
12+
let y = foo;
13+
assert_eq!(y.x, 13); // used to print 42 due to mir-opt bug
14+
}

0 commit comments

Comments
 (0)