From 0d6ff997a58f8396d5bad58e229932e761263efd Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 12 Aug 2020 12:50:24 +0200 Subject: [PATCH] add regression test for #74739 (mir const-prop bug) --- src/test/ui/issues/issue-74739.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/test/ui/issues/issue-74739.rs diff --git a/src/test/ui/issues/issue-74739.rs b/src/test/ui/issues/issue-74739.rs new file mode 100644 index 00000000000..03622358ae1 --- /dev/null +++ b/src/test/ui/issues/issue-74739.rs @@ -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 +}