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:
Yuki Okushi 2020-08-13 11:05:38 +09:00 committed by GitHub
commit 845fb94da4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View 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
}