diff options
| author | LooMaclin <loo.maclin@protonmail.com> | 2019-04-19 02:26:57 +0300 |
|---|---|---|
| committer | LooMaclin <loo.maclin@protonmail.com> | 2019-04-19 02:26:57 +0300 |
| commit | a54e3cc9e7aa938ef6e4aa3ba00864bcefc717df (patch) | |
| tree | e1d2c8372f1e09cd20c9f2a018f2f241eda79803 | |
| parent | 15d50deeb457d5761802dd1066f7bfbeaf71c2cb (diff) | |
| download | rust-a54e3cc9e7aa938ef6e4aa3ba00864bcefc717df.tar.gz rust-a54e3cc9e7aa938ef6e4aa3ba00864bcefc717df.zip | |
Improve miri's error reporting in check_in_alloc
| -rw-r--r-- | src/librustc/mir/interpret/allocation.rs | 6 | ||||
| -rw-r--r-- | src/librustc/mir/interpret/error.rs | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/librustc/mir/interpret/allocation.rs b/src/librustc/mir/interpret/allocation.rs index 79ef81e81eb..84733f9af6d 100644 --- a/src/librustc/mir/interpret/allocation.rs +++ b/src/librustc/mir/interpret/allocation.rs @@ -228,7 +228,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> { // FIXME: Working around https://github.com/rust-lang/rust/issues/56209 where Extra: AllocationExtra<Tag, MemoryExtra> { - self.get_bytes_internal(cx, ptr, size, true, CheckInAllocMsg::MemoryAccess) + self.get_bytes_internal(cx, ptr, size, true, CheckInAllocMsg::MemoryAccessTest) } /// It is the caller's responsibility to handle undefined and pointer bytes. @@ -243,7 +243,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> { // FIXME: Working around https://github.com/rust-lang/rust/issues/56209 where Extra: AllocationExtra<Tag, MemoryExtra> { - self.get_bytes_internal(cx, ptr, size, false, CheckInAllocMsg::MemoryAccess) + self.get_bytes_internal(cx, ptr, size, false, CheckInAllocMsg::MemoryAccessTest) } /// Just calling this already marks everything as defined and removes relocations, @@ -258,7 +258,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> { where Extra: AllocationExtra<Tag, MemoryExtra> { assert_ne!(size.bytes(), 0, "0-sized accesses should never even get a `Pointer`"); - self.check_bounds(cx, ptr, size, CheckInAllocMsg::MemoryAccess)?; + self.check_bounds(cx, ptr, size, CheckInAllocMsg::MemoryAccessTest)?; self.mark_definedness(ptr, size, true)?; self.clear_relocations(cx, ptr, size)?; diff --git a/src/librustc/mir/interpret/error.rs b/src/librustc/mir/interpret/error.rs index 2fe6982fdf8..cf2d12b5935 100644 --- a/src/librustc/mir/interpret/error.rs +++ b/src/librustc/mir/interpret/error.rs @@ -461,9 +461,9 @@ 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 {}, but is outside bounds of \ - allocation {} which has size {}", msg, - ptr.offset.bytes(), ptr.alloc_id, allocation_size.bytes()) + write!(f, "{} test 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()) }, ValidationFailure(ref err) => { write!(f, "type validation failed: {}", err) |
