1
Fork 0

Improve miri's error reporting in check_in_alloc

This commit is contained in:
LooMaclin 2019-04-23 03:15:27 +03:00
parent a54e3cc9e7
commit fc7ffa670c
2 changed files with 4 additions and 2 deletions

View file

@ -32,8 +32,10 @@ pub enum CheckInAllocMsg {
}
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",

View file

@ -461,7 +461,7 @@ impl<'tcx, O: fmt::Debug> fmt::Debug for InterpError<'tcx, O> {
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())
},