about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-06-07 16:48:10 +0200
committerGitHub <noreply@github.com>2019-06-07 16:48:10 +0200
commitb9c752b550321bbab47b4c4df6df7fe4443d48f1 (patch)
treefc215e8ceabdc786ed09f930a0b0f35a46d78e34
parent9bbdc40334ab6503f57f24af50ba2ce96a783994 (diff)
parent524f1463cd6b0025d77f34e6911bce6e37c3e8ea (diff)
downloadrust-b9c752b550321bbab47b4c4df6df7fe4443d48f1.tar.gz
rust-b9c752b550321bbab47b4c4df6df7fe4443d48f1.zip
Rollup merge of #61618 - RalfJung:error, r=oli-obk
make the backtrace field of EvalError private

This also makes sure people don't contruct these the wrong way (i.e., not through the `From` instance).

r? @oli-obk
-rw-r--r--src/librustc/mir/interpret/error.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/librustc/mir/interpret/error.rs b/src/librustc/mir/interpret/error.rs
index b4615aeb0db..e324abd8e2f 100644
--- a/src/librustc/mir/interpret/error.rs
+++ b/src/librustc/mir/interpret/error.rs
@@ -179,10 +179,15 @@ pub fn struct_error<'a, 'gcx, 'tcx>(
     struct_span_err!(tcx.sess, tcx.span, E0080, "{}", msg)
 }
 
+/// Packages the kind of error we got from the const code interpreter
+/// up with a Rust-level backtrace of where the error occured.
+/// Thsese should always be constructed by calling `.into()` on
+/// a `InterpError`. In `librustc_mir::interpret`, we have the `err!`
+/// macro for this
 #[derive(Debug, Clone)]
 pub struct EvalError<'tcx> {
     pub kind: InterpError<'tcx, u64>,
-    pub backtrace: Option<Box<Backtrace>>,
+    backtrace: Option<Box<Backtrace>>,
 }
 
 impl<'tcx> EvalError<'tcx> {