Skip to content

Commit 8279989

Browse files
committed
Do not intern if we have provenance.
1 parent 2bbdd52 commit 8279989

File tree

1 file changed

+6
-1
lines changed
  • compiler/rustc_mir_transform/src

1 file changed

+6
-1
lines changed

compiler/rustc_mir_transform/src/gvn.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1331,8 +1331,13 @@ fn op_to_prop_const<'tcx>(
13311331
// If this constant has scalar ABI, return it as a `ConstValue::Scalar`.
13321332
if let Abi::Scalar(abi::Scalar::Initialized { .. }) = op.layout.abi
13331333
&& let Ok(scalar) = ecx.read_scalar(op)
1334-
&& scalar.try_to_scalar_int().is_ok()
13351334
{
1335+
if !scalar.try_to_scalar_int().is_ok() {
1336+
// Check that we do not leak a pointer.
1337+
// Those pointers may lose part of their identity in codegen.
1338+
// FIXME: remove this hack once https://github.com/rust-lang/rust/issues/79738 is fixed.
1339+
return None;
1340+
}
13361341
return Some(ConstValue::Scalar(scalar));
13371342
}
13381343

0 commit comments

Comments
 (0)