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