about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLooMaclin <loo.maclin@protonmail.com>2019-04-02 06:33:54 +0300
committerLooMaclin <loo.maclin@protonmail.com>2019-04-02 06:33:54 +0300
commit705d75ef1aa20c124975786cf1ad9764a82b12ef (patch)
treed6196fc7c7fdbec876ae0c50caadfbdf99f65353
parent7b4bc6974a16df46e5d50a1191c124fc8c1f56ae (diff)
downloadrust-705d75ef1aa20c124975786cf1ad9764a82b12ef.tar.gz
rust-705d75ef1aa20c124975786cf1ad9764a82b12ef.zip
Improve miri's error reporting in check_in_alloc
-rw-r--r--src/librustc/mir/interpret/allocation.rs3
-rw-r--r--src/librustc_mir/hair/pattern/_match.rs3
-rw-r--r--src/librustc_mir/interpret/operand.rs3
3 files changed, 6 insertions, 3 deletions
diff --git a/src/librustc/mir/interpret/allocation.rs b/src/librustc/mir/interpret/allocation.rs
index a04316b719e..50f5da77c0f 100644
--- a/src/librustc/mir/interpret/allocation.rs
+++ b/src/librustc/mir/interpret/allocation.rs
@@ -353,7 +353,8 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
         // FIXME: Working around https://github.com/rust-lang/rust/issues/56209
         where Extra: AllocationExtra<Tag, MemoryExtra>
     {
-        let bytes = self.get_bytes_mut(cx, ptr, Size::from_bytes(src.len() as u64), CheckInAllocMsg::WriteBytes)?;
+        let bytes = self.get_bytes_mut(cx, ptr, Size::from_bytes(src.len() as u64),
+                                       CheckInAllocMsg::WriteBytes)?;
         bytes.clone_from_slice(src);
         Ok(())
     }
diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs
index 014c5ced37b..561ac207b6b 100644
--- a/src/librustc_mir/hair/pattern/_match.rs
+++ b/src/librustc_mir/hair/pattern/_match.rs
@@ -1418,7 +1418,8 @@ fn slice_pat_covered_by_const<'tcx>(
                 return Ok(false);
             }
             let n = n.assert_usize(tcx).unwrap();
-            alloc.get_bytes(&tcx, ptr, Size::from_bytes(n), CheckInAllocMsg::SlicePatCoveredByConst).unwrap()
+            alloc.get_bytes(&tcx, ptr, Size::from_bytes(n),
+                            CheckInAllocMsg::SlicePatCoveredByConst).unwrap()
         },
         // a slice fat pointer to a zero length slice
         (ConstValue::Slice(Scalar::Bits { .. }, 0), ty::Slice(t)) => {
diff --git a/src/librustc_mir/interpret/operand.rs b/src/librustc_mir/interpret/operand.rs
index b90ec42de7e..7529ec0aee5 100644
--- a/src/librustc_mir/interpret/operand.rs
+++ b/src/librustc_mir/interpret/operand.rs
@@ -667,7 +667,8 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> InterpretCx<'a, 'mir, 'tcx, M>
                     ScalarMaybeUndef::Scalar(Scalar::Ptr(ptr)) => {
                         // 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, CheckInAllocMsg::ReadDiscriminant).is_ok();
+                            self.memory.check_bounds_ptr(ptr,
+                                                         CheckInAllocMsg::ReadDiscriminant).is_ok();
                         if !ptr_valid {
                             return err!(InvalidDiscriminant(raw_discr.erase_tag()));
                         }