}
impl Display for CheckInAllocMsg {
+ /// When this printed as an error the context looks like this
+ /// "{test name} test failed: pointer must be in-bounds at offset..."
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- write!(f, "{}", match *self {
+ write!(f, "{} test", match *self {
CheckInAllocMsg::MemoryAccessTest => "Memory access",
CheckInAllocMsg::NullPointerTest => "Null pointer",
CheckInAllocMsg::PointerArithmeticTest => "Pointer arithmetic",
use self::InterpError::*;
match *self {
PointerOutOfBounds { ptr, msg, allocation_size } => {
- write!(f, "{} test failed: pointer must be in-bounds at offset {}, \
+ write!(f, "{} failed: pointer must be in-bounds at offset {}, \
but is outside bounds of allocation {} which has size {}",
msg, ptr.offset.bytes(), ptr.alloc_id, allocation_size.bytes())
},