about summary refs log tree commit diff
path: root/src/librustc/mir/interpret
diff options
context:
space:
mode:
authorOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>2018-01-31 10:39:30 +0100
committerOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>2018-03-08 08:34:16 +0100
commitbd03371f711adcb7724c939ea053f4090e87c16f (patch)
treeb052b81c10cad02d120d6c6be07e13bb215fbf63 /src/librustc/mir/interpret
parent8c53d54b98edd77e32fbf4f4fd27d312b251ec6b (diff)
downloadrust-bd03371f711adcb7724c939ea053f4090e87c16f.tar.gz
rust-bd03371f711adcb7724c939ea053f4090e87c16f.zip
Add stack traces to miri errors
Diffstat (limited to 'src/librustc/mir/interpret')
-rw-r--r--src/librustc/mir/interpret/error.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/librustc/mir/interpret/error.rs b/src/librustc/mir/interpret/error.rs
index 3e8aeaff57e..90d10df1515 100644
--- a/src/librustc/mir/interpret/error.rs
+++ b/src/librustc/mir/interpret/error.rs
@@ -1,6 +1,5 @@
 use std::error::Error;
 use std::{fmt, env};
-use std::rc::Rc;
 
 use mir;
 use ty::{FnSig, Ty, layout};
@@ -15,7 +14,7 @@ use backtrace::Backtrace;
 
 #[derive(Debug, Clone)]
 pub struct EvalError<'tcx> {
-    pub kind: Rc<EvalErrorKind<'tcx>>,
+    pub kind: EvalErrorKind<'tcx>,
     pub backtrace: Option<Backtrace>,
 }
 
@@ -26,7 +25,7 @@ impl<'tcx> From<EvalErrorKind<'tcx>> for EvalError<'tcx> {
             _ => None
         };
         EvalError {
-            kind: Rc::new(kind),
+            kind,
             backtrace,
         }
     }
@@ -132,7 +131,7 @@ pub type EvalResult<'tcx, T = ()> = Result<T, EvalError<'tcx>>;
 impl<'tcx> Error for EvalError<'tcx> {
     fn description(&self) -> &str {
         use self::EvalErrorKind::*;
-        match *self.kind {
+        match self.kind {
             MachineError(ref inner) => inner,
             FunctionPointerTyMismatch(..) =>
                 "tried to call a function through a function pointer of a different type",
@@ -253,7 +252,7 @@ impl<'tcx> Error for EvalError<'tcx> {
 impl<'tcx> fmt::Display for EvalError<'tcx> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         use self::EvalErrorKind::*;
-        match *self.kind {
+        match self.kind {
             PointerOutOfBounds { ptr, access, allocation_size } => {
                 write!(f, "{} at offset {}, outside bounds of allocation {} which has size {}",
                        if access { "memory access" } else { "pointer computed" },