From aadff30671c688b7c466dbeca6da84765589447b Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 4 Sep 2023 09:25:39 +0200 Subject: [PATCH 1/2] const-eval: make misalignment a hard error --- src/machine.rs | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/machine.rs b/src/machine.rs index f1c50794ca..457cfc2535 100644 --- a/src/machine.rs +++ b/src/machine.rs @@ -12,7 +12,6 @@ use rand::rngs::StdRng; use rand::SeedableRng; use rustc_ast::ast::Mutability; -use rustc_const_eval::const_eval::CheckAlignment; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; #[allow(unused)] use rustc_data_structures::static_assert_size; @@ -886,12 +885,8 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for MiriMachine<'mir, 'tcx> { const PANIC_ON_ALLOC_FAIL: bool = false; #[inline(always)] - fn enforce_alignment(ecx: &MiriInterpCx<'mir, 'tcx>) -> CheckAlignment { - if ecx.machine.check_alignment == AlignmentCheck::None { - CheckAlignment::No - } else { - CheckAlignment::Error - } + fn enforce_alignment(ecx: &MiriInterpCx<'mir, 'tcx>) -> bool { + ecx.machine.check_alignment != AlignmentCheck::None } #[inline(always)] @@ -899,15 +894,6 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for MiriMachine<'mir, 'tcx> { ecx.machine.check_alignment == AlignmentCheck::Int } - fn alignment_check_failed( - _ecx: &InterpCx<'mir, 'tcx, Self>, - has: Align, - required: Align, - _check: CheckAlignment, - ) -> InterpResult<'tcx, ()> { - throw_ub!(AlignmentCheckFailed { has, required }) - } - #[inline(always)] fn enforce_validity(ecx: &MiriInterpCx<'mir, 'tcx>, _layout: TyAndLayout<'tcx>) -> bool { ecx.machine.validate From a84bf8c4fa562c8aa238cd6ce34dc9af0a302784 Mon Sep 17 00:00:00 2001 From: The Miri Conjob Bot Date: Sat, 14 Oct 2023 04:59:42 +0000 Subject: [PATCH 2/2] Preparing for merge from rustc --- rust-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-version b/rust-version index 5e10427d17..474e7da000 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -3d575a2f2ef8a6eb99064bb31c16feb8d508f1ee +2a7c2df506fcd5611967a203cc994da5f21abd1e