Rollup merge of #75449 - RalfJung:const-prop-test, r=wesleywiser
add regression test for #74739 (mir const-prop bug) Fixes https://github.com/rust-lang/rust/issues/74739
This commit is contained in:
commit
845fb94da4
14
src/test/ui/issues/issue-74739.rs
Normal file
14
src/test/ui/issues/issue-74739.rs
Normal file
@ -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
|
||||
}
|
Loading…
Reference in New Issue
Block a user