Skip to content

Commit e9e11de

Browse files
committed
Auto merge of rust-lang#2731 - RalfJung:rustup, r=RalfJung
Rustup
2 parents 205ab4f + 3e3e5e6 commit e9e11de

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
e1c91213ff80af5b87a197b784b40bcbc8cf3add
1+
a803f313fdf8f6eb2d674d7dfb3694a2b437ee1e

src/machine.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use rand::rngs::StdRng;
99
use rand::SeedableRng;
1010

1111
use rustc_ast::ast::Mutability;
12+
use rustc_const_eval::const_eval::CheckAlignment;
1213
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
1314
#[allow(unused)]
1415
use rustc_data_structures::static_assert_size;
@@ -22,7 +23,7 @@ use rustc_middle::{
2223
};
2324
use rustc_span::def_id::{CrateNum, DefId};
2425
use rustc_span::Symbol;
25-
use rustc_target::abi::Size;
26+
use rustc_target::abi::{Align, Size};
2627
use rustc_target::spec::abi::Abi;
2728

2829
use crate::{
@@ -781,15 +782,28 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for MiriMachine<'mir, 'tcx> {
781782
const PANIC_ON_ALLOC_FAIL: bool = false;
782783

783784
#[inline(always)]
784-
fn enforce_alignment(ecx: &MiriInterpCx<'mir, 'tcx>) -> bool {
785-
ecx.machine.check_alignment != AlignmentCheck::None
785+
fn enforce_alignment(ecx: &MiriInterpCx<'mir, 'tcx>) -> CheckAlignment {
786+
if ecx.machine.check_alignment == AlignmentCheck::None {
787+
CheckAlignment::No
788+
} else {
789+
CheckAlignment::Error
790+
}
786791
}
787792

788793
#[inline(always)]
789794
fn use_addr_for_alignment_check(ecx: &MiriInterpCx<'mir, 'tcx>) -> bool {
790795
ecx.machine.check_alignment == AlignmentCheck::Int
791796
}
792797

798+
fn alignment_check_failed(
799+
_ecx: &InterpCx<'mir, 'tcx, Self>,
800+
has: Align,
801+
required: Align,
802+
_check: CheckAlignment,
803+
) -> InterpResult<'tcx, ()> {
804+
throw_ub!(AlignmentCheckFailed { has, required })
805+
}
806+
793807
#[inline(always)]
794808
fn enforce_validity(ecx: &MiriInterpCx<'mir, 'tcx>) -> bool {
795809
ecx.machine.validate

0 commit comments

Comments
 (0)