diff options
| author | LooMaclin <loo.maclin@protonmail.com> | 2019-04-19 02:10:59 +0300 |
|---|---|---|
| committer | LooMaclin <loo.maclin@protonmail.com> | 2019-04-19 02:10:59 +0300 |
| commit | 15d50deeb457d5761802dd1066f7bfbeaf71c2cb (patch) | |
| tree | 03de94cb13d1d1a6589e7268ea58486b2e026447 /src/librustc_mir/interpret | |
| parent | 0d97ad383412970b39275226bdfde7393d73867f (diff) | |
| download | rust-15d50deeb457d5761802dd1066f7bfbeaf71c2cb.tar.gz rust-15d50deeb457d5761802dd1066f7bfbeaf71c2cb.zip | |
Improve miri's error reporting in check_in_alloc
Diffstat (limited to 'src/librustc_mir/interpret')
| -rw-r--r-- | src/librustc_mir/interpret/memory.rs | 2 | ||||
| -rw-r--r-- | src/librustc_mir/interpret/operand.rs | 2 | ||||
| -rw-r--r-- | src/librustc_mir/interpret/validity.rs | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/src/librustc_mir/interpret/memory.rs b/src/librustc_mir/interpret/memory.rs index e8ae7ab579b..b176a0ac61f 100644 --- a/src/librustc_mir/interpret/memory.rs +++ b/src/librustc_mir/interpret/memory.rs @@ -253,7 +253,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { // check this is not NULL -- which we can ensure only if this is in-bounds // of some (potentially dead) allocation. let align = self.check_bounds_ptr(ptr, InboundsCheck::MaybeDead, - CheckInAllocMsg::NullPointer)?; + CheckInAllocMsg::NullPointerTest)?; (ptr.offset.bytes(), align) } Scalar::Bits { bits, size } => { diff --git a/src/librustc_mir/interpret/operand.rs b/src/librustc_mir/interpret/operand.rs index 38fe1caa41f..8d9550e8f07 100644 --- a/src/librustc_mir/interpret/operand.rs +++ b/src/librustc_mir/interpret/operand.rs @@ -668,7 +668,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> InterpretCx<'a, 'mir, 'tcx, M> // The niche must be just 0 (which an inbounds pointer value never is) let ptr_valid = niche_start == 0 && variants_start == variants_end && self.memory.check_bounds_ptr(ptr, InboundsCheck::MaybeDead, - CheckInAllocMsg::OutOfBounds).is_ok(); + CheckInAllocMsg::NullPointerTest).is_ok(); if !ptr_valid { return err!(InvalidDiscriminant(raw_discr.erase_tag())); } diff --git a/src/librustc_mir/interpret/validity.rs b/src/librustc_mir/interpret/validity.rs index 965b2898cad..ebba704e4f4 100644 --- a/src/librustc_mir/interpret/validity.rs +++ b/src/librustc_mir/interpret/validity.rs @@ -394,7 +394,7 @@ impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> try_validation!( self.ecx.memory .get(ptr.alloc_id)? - .check_bounds(self.ecx, ptr, size, CheckInAllocMsg::OutOfBounds), + .check_bounds(self.ecx, ptr, size, CheckInAllocMsg::InboundsTest), "dangling (not entirely in bounds) reference", self.path); } // Check if we have encountered this pointer+layout combination |
