Skip to content

Commit fe181de

Browse files
committed
interpret: always enable write_immediate sanity checks
1 parent 1d9162b commit fe181de

File tree

1 file changed

+3
-6
lines changed
  • compiler/rustc_const_eval/src/interpret

1 file changed

+3
-6
lines changed

compiler/rustc_const_eval/src/interpret/place.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -652,9 +652,7 @@ where
652652
M::after_local_write(self, local, /*storage_live*/ false)?;
653653
}
654654
// Double-check that the value we are storing and the local fit to each other.
655-
if cfg!(debug_assertions) {
656-
src.assert_matches_abi(local_layout.abi, self);
657-
}
655+
src.assert_matches_abi(local_layout.abi, self);
658656
}
659657
Left(mplace) => {
660658
self.write_immediate_to_mplace_no_validate(src, mplace.layout, mplace.mplace)?;
@@ -672,9 +670,8 @@ where
672670
layout: TyAndLayout<'tcx>,
673671
dest: MemPlace<M::Provenance>,
674672
) -> InterpResult<'tcx> {
675-
if cfg!(debug_assertions) {
676-
value.assert_matches_abi(layout.abi, self);
677-
}
673+
// Ensure the value matches the type of the place it is written to.
674+
value.assert_matches_abi(layout.abi, self);
678675
// Note that it is really important that the type here is the right one, and matches the
679676
// type things are read at. In case `value` is a `ScalarPair`, we don't do any magic here
680677
// to handle padding properly, which is only correct if we never look at this data with the

0 commit comments

Comments
 (0)