Pointer { alloc_id: self.alloc_id, offset: self.offset, tag: () }
}
+ /// Test if the pointer is "inbounds" of an allocation of the given size.
+ /// A pointer is "inbounds" even if its offset is equal to the size; this is
+ /// a "one-past-the-end" pointer.
#[inline(always)]
- pub fn check_in_alloc(
+ pub fn check_inbounds_alloc(
self,
allocation_size: Size,
msg: CheckInAllocMsg,
// It is sufficient to check this for the end pointer. The addition
// checks for overflow.
let end_ptr = ptr.offset(size, self)?;
- end_ptr.check_in_alloc(allocation_size, CheckInAllocMsg::MemoryAccessTest)?;
+ end_ptr.check_inbounds_alloc(allocation_size, CheckInAllocMsg::MemoryAccessTest)?;
// Test align. Check this last; if both bounds and alignment are violated
// we want the error to be about the bounds.
if alloc_align.bytes() < align.bytes() {
) -> bool {
let (size, _align) = self.get_size_and_align(ptr.alloc_id, AllocCheck::MaybeDead)
.expect("alloc info with MaybeDead cannot fail");
- ptr.check_in_alloc(size, CheckInAllocMsg::NullPointerTest).is_err()
+ ptr.check_inbounds_alloc(size, CheckInAllocMsg::NullPointerTest).is_err()
}
}