about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorTomasz Miąsko <tomasz.miasko@gmail.com>2021-12-11 00:00:00 +0000
committerTomasz Miąsko <tomasz.miasko@gmail.com>2021-12-14 17:09:00 +0100
commitffe067cdfcedd34989fb6ece769eb34a24eb4f9c (patch)
treeeabd2f2f400c60c0df5ca72fbdf903bc18d76db8 /src
parent404c8471aba60c2d837fa728e7c729a0f52d5830 (diff)
downloadrust-ffe067cdfcedd34989fb6ece769eb34a24eb4f9c.tar.gz
rust-ffe067cdfcedd34989fb6ece769eb34a24eb4f9c.zip
Return an error when `eval_rvalue_with_identities` fails
Previously some code paths would fail to evaluate the rvalue, while
incorrectly indicating success with `Ok`. As a result the previous value
of lhs could have been incorrectly const propagated.
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/mir/mir_const_prop_identity.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/ui/mir/mir_const_prop_identity.rs b/src/test/ui/mir/mir_const_prop_identity.rs
new file mode 100644
index 00000000000..25d2202b909
--- /dev/null
+++ b/src/test/ui/mir/mir_const_prop_identity.rs
@@ -0,0 +1,12 @@
+// Regression test for issue #91725.
+//
+// run-pass
+// compile-flags: -Zmir-opt-level=4
+
+fn main() {
+    let a = true;
+    let _ = &a;
+    let mut b = false;
+    b |= a;
+    assert!(b);
+}