cx: &impl HasDataLayout,
ptr: Pointer<Tag>,
size: Size,
- msg: CheckInAllocMsg,
) -> EvalResult<'tcx, &[u8]>
// FIXME: Working around https://github.com/rust-lang/rust/issues/56209
where Extra: AllocationExtra<Tag, MemoryExtra>
{
- 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.
// 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())),
}
{
// 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() {
};
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
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};
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)) => {
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!(