Skip to content

Commit 21b99ba

Browse files
committed
Move alignment failure error reporting to machine
1 parent be42b04 commit 21b99ba

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/machine.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use rustc_middle::{
2222
};
2323
use rustc_span::def_id::{CrateNum, DefId};
2424
use rustc_span::Symbol;
25-
use rustc_target::abi::Size;
25+
use rustc_target::abi::{Size, Align};
2626
use rustc_target::spec::abi::Abi;
2727
use rustc_const_eval::const_eval::CheckAlignment;
2828

@@ -766,6 +766,15 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for MiriMachine<'mir, 'tcx> {
766766
ecx.machine.check_alignment == AlignmentCheck::Int
767767
}
768768

769+
fn alignment_check_failed(
770+
_ecx: &InterpCx<'mir, 'tcx, Self>,
771+
has: Align,
772+
required: Align,
773+
_check: CheckAlignment,
774+
) -> InterpResult<'tcx, ()> {
775+
throw_ub!(AlignmentCheckFailed { has, required })
776+
}
777+
769778
#[inline(always)]
770779
fn enforce_validity(ecx: &MiriInterpCx<'mir, 'tcx>) -> bool {
771780
ecx.machine.validate

0 commit comments

Comments
 (0)