diff --git a/src/librustc/mir/interpret/allocation.rs b/src/librustc/mir/interpret/allocation.rs index 19f28b96c3a7..61f77171ce35 100644 --- a/src/librustc/mir/interpret/allocation.rs +++ b/src/librustc/mir/interpret/allocation.rs @@ -224,12 +224,11 @@ impl<'tcx, Tag: Copy, Extra> Allocation { cx: &impl HasDataLayout, ptr: Pointer, size: Size, - msg: CheckInAllocMsg, ) -> EvalResult<'tcx, &[u8]> // FIXME: Working around https://github.com/rust-lang/rust/issues/56209 where Extra: AllocationExtra { - self.get_bytes_internal(cx, ptr, size, true, msg) + self.get_bytes_internal(cx, ptr, size, true, CheckInAllocMsg::MemoryAccess) } /// It is the caller's responsibility to handle undefined and pointer bytes. @@ -295,7 +294,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation { // Go through `get_bytes` for checks and AllocationExtra hooks. // We read the null, so we include it in the request, but we want it removed // from the result! - Ok(&self.get_bytes(cx, ptr, size_with_null, CheckInAllocMsg::NullPointer)?[..size]) + Ok(&self.get_bytes(cx, ptr, size_with_null)?[..size]) } None => err!(UnterminatedCString(ptr.erase_tag())), } @@ -379,7 +378,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation { { // get_bytes_unchecked tests relocation edges let bytes = self.get_bytes_with_undef_and_ptr(cx, ptr, size, - CheckInAllocMsg::PointerArithmetic)?; + CheckInAllocMsg::MemoryAccess)?; // Undef check happens *after* we established that the alignment is correct. // We must not return Ok() for unaligned pointers! if self.check_defined(ptr, size).is_err() { @@ -456,7 +455,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation { }; let endian = cx.data_layout().endian; - let dst = self.get_bytes_mut(cx, ptr, type_size, CheckInAllocMsg::PointerArithmetic)?; + let dst = self.get_bytes_mut(cx, ptr, type_size, CheckInAllocMsg::MemoryAccess)?; write_target_uint(endian, dst, bytes).unwrap(); // See if we have to also write a relocation diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs index 1e2ffa5db440..303ffcb3bfb3 100644 --- a/src/librustc_mir/hair/pattern/_match.rs +++ b/src/librustc_mir/hair/pattern/_match.rs @@ -172,7 +172,7 @@ use rustc::ty::{self, Ty, TyCtxt, TypeFoldable, Const}; use rustc::ty::layout::{Integer, IntegerExt, VariantIdx, Size}; use rustc::mir::Field; -use rustc::mir::interpret::{ConstValue, Scalar, truncate, CheckInAllocMsg}; +use rustc::mir::interpret::{ConstValue, Scalar, truncate}; use rustc::util::common::ErrorReported; use syntax::attr::{SignedInt, UnsignedInt}; @@ -1418,8 +1418,7 @@ fn slice_pat_covered_by_const<'tcx>( return Ok(false); } let n = n.assert_usize(tcx).unwrap(); - alloc.get_bytes(&tcx, ptr, Size::from_bytes(n), - CheckInAllocMsg::OutOfBounds).unwrap() + alloc.get_bytes(&tcx, ptr, Size::from_bytes(n)).unwrap() }, // a slice fat pointer to a zero length slice (ConstValue::Slice(Scalar::Bits { .. }, 0), ty::Slice(t)) => { @@ -1444,7 +1443,7 @@ fn slice_pat_covered_by_const<'tcx>( tcx.alloc_map .lock() .unwrap_memory(ptr.alloc_id) - .get_bytes(&tcx, ptr, Size::from_bytes(n), CheckInAllocMsg::OutOfBounds) + .get_bytes(&tcx, ptr, Size::from_bytes(n)) .unwrap() }, _ => bug!( diff --git a/src/librustc_mir/interpret/memory.rs b/src/librustc_mir/interpret/memory.rs index cc8bed770c46..b9e2b9d499e5 100644 --- a/src/librustc_mir/interpret/memory.rs +++ b/src/librustc_mir/interpret/memory.rs @@ -606,7 +606,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { Ok(&[]) } else { let ptr = ptr.to_ptr()?; - self.get(ptr.alloc_id)?.get_bytes(self, ptr, size, CheckInAllocMsg::MemoryAccess) + self.get(ptr.alloc_id)?.get_bytes(self, ptr, size) } } }