Skip to content

Commit 4067795

Browse files
committed
Do not intern if we have provenance.
1 parent 98c1ea8 commit 4067795

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
@@ -1389,8 +1389,13 @@ fn op_to_prop_const<'tcx>(
13891389
// If this constant has scalar ABI, return it as a `ConstValue::Scalar`.
13901390
if let Abi::Scalar(abi::Scalar::Initialized { .. }) = op.layout.abi
13911391
&& let Ok(scalar) = ecx.read_scalar(op)
1392-
&& scalar.try_to_scalar_int().is_ok()
13931392
{
1393+
if !scalar.try_to_scalar_int().is_ok() {
1394+
// Check that we do not leak a pointer.
1395+
// Those pointers may lose part of their identity in codegen.
1396+
// FIXME: remove this hack once https://github.com/rust-lang/rust/issues/79738 is fixed.
1397+
return None;
1398+
}
13941399
return Some(ConstValue::Scalar(scalar));
13951400
}
13961401

0 commit comments

Comments
 (0)