size: Size,
allow_ptr_and_undef: bool,
) -> EvalResult<'tcx> {
- // Empty accesses don't need to be valid pointers, but they should still be non-NULL
let align = Align::from_bytes(1).unwrap();
- if size.bytes() == 0 {
- self.check_align(ptr, align)?;
- return Ok(());
- }
// Check bounds, align and relocations on the edges
self.get_bytes_with_undef_and_ptr(cx, ptr, size, align)?;
// Check undef and ptr
ptr: Pointer<Tag>,
size: Size,
) -> EvalResult<'tcx, &[u8]> {
- // Empty accesses don't need to be valid pointers, but they should still be non-NULL
let align = Align::from_bytes(1).unwrap();
- if size.bytes() == 0 {
- self.check_align(ptr, align)?;
- return Ok(&[]);
- }
self.get_bytes(cx, ptr, size, align)
}
ptr: Pointer<Tag>,
src: &[u8],
) -> EvalResult<'tcx> {
- // Empty accesses don't need to be valid pointers, but they should still be non-NULL
let align = Align::from_bytes(1).unwrap();
- if src.is_empty() {
- self.check_align(ptr, align)?;
- return Ok(());
- }
let bytes = self.get_bytes_mut(
cx, ptr, Size::from_bytes(src.len() as u64), align,
)?;
val: u8,
count: Size
) -> EvalResult<'tcx> {
- // Empty accesses don't need to be valid pointers, but they should still be non-NULL
let align = Align::from_bytes(1).unwrap();
- if count.bytes() == 0 {
- self.check_align(ptr, align)?;
- return Ok(());
- }
let bytes = self.get_bytes_mut(cx, ptr, count, align)?;
for b in bytes {
*b = val;
align: Align,
check_defined_and_ptr: bool,
) -> EvalResult<'tcx, &[u8]> {
- assert_ne!(size.bytes(), 0, "0-sized accesses should never even get a `Pointer`");
self.check_align(ptr.into(), align)?;
self.check_bounds(cx, ptr, size)?;