We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 98c1ea8 commit 4067795Copy full SHA for 4067795
compiler/rustc_mir_transform/src/gvn.rs
@@ -1389,8 +1389,13 @@ fn op_to_prop_const<'tcx>(
1389
// If this constant has scalar ABI, return it as a `ConstValue::Scalar`.
1390
if let Abi::Scalar(abi::Scalar::Initialized { .. }) = op.layout.abi
1391
&& let Ok(scalar) = ecx.read_scalar(op)
1392
- && scalar.try_to_scalar_int().is_ok()
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
+ }
1399
return Some(ConstValue::Scalar(scalar));
1400
}
1401
0 commit comments