]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/mir/interpret/pointer.rs
rename EvalResult -> InterpResult and EvalError -> InterpErrorInfo
[rust.git] / src / librustc / mir / interpret / pointer.rs
index 9e71399d4fdf7eacd9d02e4e12d1932e35b7ae74..a6c47ff5ca0f77128b14f87c7cf2c2125c7b3c49 100644 (file)
@@ -5,7 +5,7 @@
 use rustc_macros::HashStable;
 
 use super::{
-    AllocId, EvalResult, CheckInAllocMsg
+    AllocId, InterpResult, CheckInAllocMsg
 };
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -52,13 +52,13 @@ fn overflowing_signed_offset(&self, val: u64, i: i128) -> (u64, bool) {
     }
 
     #[inline]
-    fn offset<'tcx>(&self, val: u64, i: u64) -> EvalResult<'tcx, u64> {
+    fn offset<'tcx>(&self, val: u64, i: u64) -> InterpResult<'tcx, u64> {
         let (res, over) = self.overflowing_offset(val, i);
         if over { err!(Overflow(mir::BinOp::Add)) } else { Ok(res) }
     }
 
     #[inline]
-    fn signed_offset<'tcx>(&self, val: u64, i: i64) -> EvalResult<'tcx, u64> {
+    fn signed_offset<'tcx>(&self, val: u64, i: i64) -> InterpResult<'tcx, u64> {
         let (res, over) = self.overflowing_signed_offset(val, i128::from(i));
         if over { err!(Overflow(mir::BinOp::Add)) } else { Ok(res) }
     }
@@ -116,13 +116,6 @@ pub fn with_tag<Tag>(self, tag: Tag) -> Pointer<Tag>
     {
         Pointer::new_with_tag(self.alloc_id, self.offset, tag)
     }
-
-    #[inline(always)]
-    pub fn with_default_tag<Tag>(self) -> Pointer<Tag>
-        where Tag: Default
-    {
-        self.with_tag(Tag::default())
-    }
 }
 
 impl<'tcx, Tag> Pointer<Tag> {
@@ -132,7 +125,7 @@ pub fn new_with_tag(alloc_id: AllocId, offset: Size, tag: Tag) -> Self {
     }
 
     #[inline]
-    pub fn offset(self, i: Size, cx: &impl HasDataLayout) -> EvalResult<'tcx, Self> {
+    pub fn offset(self, i: Size, cx: &impl HasDataLayout) -> InterpResult<'tcx, Self> {
         Ok(Pointer::new_with_tag(
             self.alloc_id,
             Size::from_bytes(cx.data_layout().offset(self.offset.bytes(), i.bytes())?),
@@ -152,7 +145,7 @@ pub fn wrapping_offset(self, i: Size, cx: &impl HasDataLayout) -> Self {
     }
 
     #[inline]
-    pub fn signed_offset(self, i: i64, cx: &impl HasDataLayout) -> EvalResult<'tcx, Self> {
+    pub fn signed_offset(self, i: i64, cx: &impl HasDataLayout) -> InterpResult<'tcx, Self> {
         Ok(Pointer::new_with_tag(
             self.alloc_id,
             Size::from_bytes(cx.data_layout().signed_offset(self.offset.bytes(), i)?),
@@ -181,7 +174,7 @@ pub fn check_in_alloc(
         self,
         allocation_size: Size,
         msg: CheckInAllocMsg,
-    ) -> EvalResult<'tcx, ()> {
+    ) -> InterpResult<'tcx, ()> {
         if self.offset > allocation_size {
             err!(PointerOutOfBounds {
                 ptr: self.erase_tag(),