impl From<ErrorHandled> for InterpErrorInfo<'_> {
fn from(err: ErrorHandled) -> Self {
match err {
- ErrorHandled::Reported(ErrorGuaranteed) | ErrorHandled::Linted => {
+ ErrorHandled::Reported(ErrorGuaranteed { .. }) | ErrorHandled::Linted => {
err_inval!(ReferencedConstant)
}
ErrorHandled::TooGeneric => err_inval!(TooGeneric),
match self {
TooGeneric => write!(f, "encountered overly generic constant"),
ReferencedConstant => write!(f, "referenced constant has errors"),
- AlreadyReported(ErrorGuaranteed) => {
+ AlreadyReported(ErrorGuaranteed { .. }) => {
write!(f, "encountered constants with type errors, stopping evaluation")
}
Layout(ref err) => write!(f, "{}", err),
MemoryAccessTest,
/// We are doing pointer arithmetic.
PointerArithmeticTest,
+ /// We are doing pointer offset_from.
+ OffsetFromTest,
/// None of the above -- generic/unspecific inbounds test.
InboundsTest,
}
CheckInAllocMsg::DerefTest => "dereferencing pointer failed: ",
CheckInAllocMsg::MemoryAccessTest => "memory access failed: ",
CheckInAllocMsg::PointerArithmeticTest => "pointer arithmetic failed: ",
+ CheckInAllocMsg::OffsetFromTest => "out-of-bounds offset_from: ",
CheckInAllocMsg::InboundsTest => "",
}
)
DanglingIntPointer(0, CheckInAllocMsg::InboundsTest) => {
write!(f, "null pointer is not a valid pointer for this operation")
}
+ DanglingIntPointer(0, msg) => {
+ write!(f, "{}null pointer is not a valid pointer", msg)
+ }
DanglingIntPointer(i, msg) => {
write!(f, "{}0x{:x} is not a valid pointer", msg, i)
}
Pointer::new(*alloc, access.access_offset),
access.uninit_size.bytes(),
pluralize!(access.uninit_size.bytes()),
- if access.uninit_size.bytes() != 1 { "are" } else { "is" },
+ pluralize!("is", access.uninit_size.bytes()),
Pointer::new(*alloc, access.uninit_offset),
),
InvalidUninitBytes(None) => write!(