Skip to content

Commit efc4776

Browse files
authored
Rollup merge of rust-lang#75449 - RalfJung:const-prop-test, r=wesleywiser
add regression test for rust-lang#74739 (mir const-prop bug) Fixes rust-lang#74739
2 parents 8cb3a0e + 0d6ff99 commit efc4776

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)