use CheckInAllocMsg::PointerArithmeticTest for ptr_offset error
This commit is contained in:
@@ -526,7 +526,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
||||
min_ptr,
|
||||
Size::from_bytes(size),
|
||||
None,
|
||||
CheckInAllocMsg::InboundsTest,
|
||||
CheckInAllocMsg::PointerArithmeticTest,
|
||||
)?;
|
||||
Ok(offset_ptr)
|
||||
}
|
||||
|
||||
@@ -369,6 +369,7 @@ pub trait Machine<'mir, 'tcx>: Sized {
|
||||
) -> InterpResult<'tcx, Pointer<Self::PointerTag>> {
|
||||
Err((if int == 0 {
|
||||
// This is UB, seriously.
|
||||
// (`DanglingIntPointer` with these exact arguments has special printing code.)
|
||||
err_ub!(DanglingIntPointer(0, CheckInAllocMsg::InboundsTest))
|
||||
} else {
|
||||
// This is just something we cannot support during const-eval.
|
||||
|
||||
@@ -330,7 +330,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
|
||||
vtable,
|
||||
3 * self.ecx.tcx.data_layout.pointer_size, // drop, size, align
|
||||
Some(self.ecx.tcx.data_layout.pointer_align.abi),
|
||||
CheckInAllocMsg::InboundsTest,
|
||||
CheckInAllocMsg::InboundsTest, // will anyway be replaced by validity message
|
||||
),
|
||||
self.path,
|
||||
err_ub!(DanglingIntPointer(..)) |
|
||||
@@ -416,7 +416,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
|
||||
place.ptr,
|
||||
size,
|
||||
Some(align),
|
||||
CheckInAllocMsg::InboundsTest,
|
||||
CheckInAllocMsg::InboundsTest, // will anyway be replaced by validity message
|
||||
),
|
||||
self.path,
|
||||
err_ub!(AlignmentCheckFailed { required, has }) =>
|
||||
|
||||
Reference in New Issue
Block a user