diff --git a/src/librustc/mir/interpret/allocation.rs b/src/librustc/mir/interpret/allocation.rs index f00da804e953..a04316b719e8 100644 --- a/src/librustc/mir/interpret/allocation.rs +++ b/src/librustc/mir/interpret/allocation.rs @@ -22,8 +22,7 @@ pub enum InboundsCheck { MaybeDead, } -/// Used by `check_in_alloc` to indicate whether the pointer needs to be just inbounds -/// or also inbounds of a *live* allocation. +/// Used by `check_in_alloc` to indicate context of check #[derive(Debug, Copy, Clone, RustcEncodable, RustcDecodable, HashStable)] pub enum CheckInAllocMsg { ReadCStr, diff --git a/src/librustc_mir/interpret/memory.rs b/src/librustc_mir/interpret/memory.rs index 302bc84e65c4..80efafa65503 100644 --- a/src/librustc_mir/interpret/memory.rs +++ b/src/librustc_mir/interpret/memory.rs @@ -20,7 +20,7 @@ use syntax::ast::Mutability; use super::{ Pointer, AllocId, Allocation, GlobalId, AllocationExtra, EvalResult, Scalar, EvalErrorKind, AllocKind, PointerArithmetic, - Machine, AllocMap, MayLeak, ErrorHandled, InboundsCheck, CheckInAllocMsg, + Machine, AllocMap, MayLeak, ErrorHandled, CheckInAllocMsg, }; #[derive(Debug, PartialEq, Eq, Copy, Clone, Hash)] @@ -440,13 +440,13 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { Ok((layout.size, layout.align.abi)) } _ => match msg { - InboundsCheck::MaybeDead => { + CheckInAllocMsg::CheckAlign | CheckInAllocMsg::ReadDiscriminant => { // Must be a deallocated pointer Ok(*self.dead_alloc_map.get(&id).expect( "allocation missing in dead_alloc_map" )) }, - InboundsCheck::Live => err!(DanglingPointerDeref), + _ => err!(DanglingPointerDeref), }, } }