about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLooMaclin <loo.maclin@protonmail.com>2019-04-23 03:15:27 +0300
committerLooMaclin <loo.maclin@protonmail.com>2019-04-23 03:15:27 +0300
commitfc7ffa670c1eeea4999aa84d131c4fd5358da43b (patch)
tree4a8e57ba07cfabc1a3bc44ea78404a40f6a2ef9f
parenta54e3cc9e7aa938ef6e4aa3ba00864bcefc717df (diff)
downloadrust-fc7ffa670c1eeea4999aa84d131c4fd5358da43b.tar.gz
rust-fc7ffa670c1eeea4999aa84d131c4fd5358da43b.zip
Improve miri's error reporting in check_in_alloc
-rw-r--r--src/librustc/mir/interpret/allocation.rs4
-rw-r--r--src/librustc/mir/interpret/error.rs2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/librustc/mir/interpret/allocation.rs b/src/librustc/mir/interpret/allocation.rs
index 84733f9af6d..bc2dbfcbf38 100644
--- a/src/librustc/mir/interpret/allocation.rs
+++ b/src/librustc/mir/interpret/allocation.rs
@@ -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",
diff --git a/src/librustc/mir/interpret/error.rs b/src/librustc/mir/interpret/error.rs
index cf2d12b5935..ce281cf0d34 100644
--- a/src/librustc/mir/interpret/error.rs
+++ b/src/librustc/mir/interpret/error.rs
@@ -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())
             },