summaryrefslogtreecommitdiffstats
path: root/src/test/ui/mir/issue-74739.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/mir/issue-74739.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/ui/mir/issue-74739.rs b/src/test/ui/mir/issue-74739.rs
new file mode 100644
index 000000000..03622358a
--- /dev/null
+++ b/src/test/ui/mir/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
+}