about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2024-11-01 14:32:09 +0000
committerRalf Jung <post@ralfj.de>2024-11-25 20:19:08 +0100
commit917dd826286bd85e26310e4db4a125d4038c277e (patch)
tree96d8492f367d0f4b773139f8cb2409d3cfd46283 /compiler/rustc_mir_transform/src
parent2cc0ee65d9c00eb717fe3d75a83c673e5c03dac2 (diff)
downloadrust-917dd826286bd85e26310e4db4a125d4038c277e.tar.gz
rust-917dd826286bd85e26310e4db4a125d4038c277e.zip
Do not unify dereferences in GVN.
Diffstat (limited to 'compiler/rustc_mir_transform/src')
-rw-r--r--compiler/rustc_mir_transform/src/gvn.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_mir_transform/src/gvn.rs b/compiler/rustc_mir_transform/src/gvn.rs
index 976f4a8e919..d5a813ec8ec 100644
--- a/compiler/rustc_mir_transform/src/gvn.rs
+++ b/compiler/rustc_mir_transform/src/gvn.rs
@@ -638,7 +638,9 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
         let proj = match proj {
             ProjectionElem::Deref => {
                 let ty = place.ty(self.local_decls, self.tcx).ty;
-                if let Some(Mutability::Not) = ty.ref_mutability()
+                // unsound: https://github.com/rust-lang/rust/issues/130853
+                if self.tcx.sess.opts.unstable_opts.unsound_mir_opts
+                    && let Some(Mutability::Not) = ty.ref_mutability()
                     && let Some(pointee_ty) = ty.builtin_deref(true)
                     && pointee_ty.is_freeze(self.tcx, self.typing_env())
                 {