Skip to content

Commit

Permalink
Do not intern if we have provenance.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Jul 31, 2024
1 parent 98c1ea8 commit 4067795
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion compiler/rustc_mir_transform/src/gvn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1389,8 +1389,13 @@ fn op_to_prop_const<'tcx>(
// If this constant has scalar ABI, return it as a `ConstValue::Scalar`.
if let Abi::Scalar(abi::Scalar::Initialized { .. }) = op.layout.abi
&& let Ok(scalar) = ecx.read_scalar(op)
&& scalar.try_to_scalar_int().is_ok()
{
if !scalar.try_to_scalar_int().is_ok() {
// Check that we do not leak a pointer.
// Those pointers may lose part of their identity in codegen.
// FIXME: remove this hack once https://github.com/rust-lang/rust/issues/79738 is fixed.
return None;
}
return Some(ConstValue::Scalar(scalar));
}

Expand Down

0 comments on commit 4067795

Please sign in to comment.