about summary refs log tree commit diff
path: root/src/librustc
diff options
context:
space:
mode:
authorSaleem Jaffer <ssaleem1992@gmail.com>2019-07-20 11:48:16 +0530
committerSaleem Jaffer <ssaleem1992@gmail.com>2019-07-20 11:48:16 +0530
commitfd352b02e17d78f03345ebc3ffabe02b0cb04fd1 (patch)
tree0a060ee393851acfae718647273501b252c7d2d2 /src/librustc
parent589f6a7dc66d88739485a1f9044ab29c166420a0 (diff)
downloadrust-fd352b02e17d78f03345ebc3ffabe02b0cb04fd1.tar.gz
rust-fd352b02e17d78f03345ebc3ffabe02b0cb04fd1.zip
alters the panic variant of InterpError
Diffstat (limited to 'src/librustc')
-rw-r--r--src/librustc/mir/interpret/error.rs59
-rw-r--r--src/librustc/mir/interpret/mod.rs2
2 files changed, 22 insertions, 39 deletions
diff --git a/src/librustc/mir/interpret/error.rs b/src/librustc/mir/interpret/error.rs
index d5caa3c8ce4..9e216a14874 100644
--- a/src/librustc/mir/interpret/error.rs
+++ b/src/librustc/mir/interpret/error.rs
@@ -229,6 +229,24 @@ impl<'tcx> From<InterpError<'tcx, u64>> for InterpErrorInfo<'tcx> {
 pub type AssertMessage<'tcx> = InterpError<'tcx, mir::Operand<'tcx>>;
 
 #[derive(Clone, RustcEncodable, RustcDecodable, HashStable)]
+pub enum EvalErrorPanic<O> {
+    Panic {
+        msg: Symbol,
+        line: u32,
+        col: u32,
+        file: Symbol,
+    },
+    BoundsCheck {
+        len: O,
+        index: O,
+    },
+    Overflow(mir::BinOp),
+    OverflowNeg,
+    DivisionByZero,
+    RemainderByZero,
+}
+
+#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)]
 pub enum InterpError<'tcx, O> {
     /// This variant is used by machines to signal their own errors that do not
     /// match an existing variant.
@@ -247,7 +265,6 @@ pub enum InterpError<'tcx, O> {
     DanglingPointerDeref,
     DoubleFree,
     InvalidMemoryAccess,
-    FunctionPointerTyMismatch(FnSig<'tcx>, FnSig<'tcx>),
     InvalidFunctionPointer,
     InvalidBool,
     InvalidDiscriminant(ScalarMaybeUndef),
@@ -267,13 +284,11 @@ pub enum InterpError<'tcx, O> {
     Unimplemented(String),
     DerefFunctionPointer,
     ExecuteMemory,
-    // asd
     BoundsCheck { len: O, index: O },
     Overflow(mir::BinOp),
     OverflowNeg,
     DivisionByZero,
     RemainderByZero,
-    // asd
     Intrinsic(String),
     InvalidChar(u128),
     StackFrameLimitReached,
@@ -284,29 +299,6 @@ pub enum InterpError<'tcx, O> {
         required: Align,
         has: Align,
     },
-    MemoryLockViolation {
-        ptr: Pointer,
-        len: u64,
-        frame: usize,
-        access: AccessKind,
-        lock: Lock,
-    },
-    MemoryAcquireConflict {
-        ptr: Pointer,
-        len: u64,
-        kind: AccessKind,
-        lock: Lock,
-    },
-    InvalidMemoryLockRelease {
-        ptr: Pointer,
-        len: u64,
-        frame: usize,
-        lock: Lock,
-    },
-    DeallocatedLockedMemory {
-        ptr: Pointer,
-        lock: Lock,
-    },
     ValidationFailure(String),
     CalledClosureAsFunction,
     VtableForArgumentlessMethod,
@@ -324,7 +316,7 @@ pub enum InterpError<'tcx, O> {
     HeapAllocZeroBytes,
     HeapAllocNonPowerOfTwoAlignment(u64),
     Unreachable,
-    Panic(EvalErrorPanic<'tcx, O>),
+    Panic(EvalErrorPanic<O>),
     ReadFromReturnPointer,
     PathNotFound(Vec<String>),
     UnimplementedTraitSelection,
@@ -340,15 +332,6 @@ pub enum InterpError<'tcx, O> {
     InfiniteLoop,
 }
 
-#[derive(Clone, RustcEncodable, RustcDecodable)]
-pub enum EvalErrorPanic<'tcx, O> {
-    Panic,
-    BoundsCheck { len: O, index: O },
-    Overflow(mir::BinOp),
-    OverflowNeg,
-    DivisionByZero,
-    RemainderByZero,
-}
 
 pub type InterpResult<'tcx, T = ()> = Result<T, InterpErrorInfo<'tcx>>;
 
@@ -549,8 +532,8 @@ impl<'tcx, O: fmt::Debug> fmt::Debug for InterpError<'tcx, O> {
                 write!(f, "incorrect alloc info: expected size {} and align {}, \
                            got size {} and align {}",
                     size.bytes(), align.bytes(), size2.bytes(), align2.bytes()),
-            Panic { ref msg, line, col, ref file } =>
-                write!(f, "the evaluated program panicked at '{}', {}:{}:{}", msg, file, line, col),
+            Panic { .. } =>
+                write!(f, "the evaluated program panicked"),
             InvalidDiscriminant(val) =>
                 write!(f, "encountered invalid enum discriminant {}", val),
             Exit(code) =>
diff --git a/src/librustc/mir/interpret/mod.rs b/src/librustc/mir/interpret/mod.rs
index 1b294250aa3..01bc27d55e5 100644
--- a/src/librustc/mir/interpret/mod.rs
+++ b/src/librustc/mir/interpret/mod.rs
@@ -12,7 +12,7 @@ mod pointer;
 
 pub use self::error::{
     InterpErrorInfo, InterpResult, InterpError, AssertMessage, ConstEvalErr, struct_error,
-    FrameInfo, ConstEvalRawResult, ConstEvalResult, ErrorHandled,
+    FrameInfo, ConstEvalRawResult, ConstEvalResult, ErrorHandled, EvalErrorPanic
 };
 
 pub use self::value::{Scalar, ScalarMaybeUndef, RawConst, ConstValue};