Skip to content

Commit 7bceb4f

Browse files
committed
Fortify transmute check.
1 parent 8569865 commit 7bceb4f

File tree

1 file changed

+3
-4
lines changed
  • compiler/rustc_mir_transform/src

1 file changed

+3
-4
lines changed

compiler/rustc_mir_transform/src/gvn.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -471,10 +471,9 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
471471
// `offset` for immediates only supports scalar/scalar-pair ABIs,
472472
// so bail out if the target is not one.
473473
if value.as_mplace_or_imm().is_right() {
474-
match to.abi {
475-
Abi::Scalar(..) | Abi::ScalarPair(..) => {}
476-
_ if to.is_zst() => {}
477-
Abi::Aggregate { .. } if to.fields.count() == 0 => {}
474+
match (value.layout.abi, to.abi) {
475+
(Abi::Scalar(..), Abi::Scalar(..)) => {}
476+
(Abi::ScalarPair(..), Abi::ScalarPair(..)) => {}
478477
_ => return None,
479478
}
480479
}

0 commit comments

Comments
 (0)