From 625763fddd4281200f0f244a601f659fa1782de5 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 7 Jun 2019 13:48:38 +0200 Subject: [PATCH 1/2] make the backtrace field of EvalError private This also makes sure people don't contruct these the wrong way --- src/librustc/mir/interpret/error.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc/mir/interpret/error.rs b/src/librustc/mir/interpret/error.rs index b4615aeb0db15..83204dcf62bac 100644 --- a/src/librustc/mir/interpret/error.rs +++ b/src/librustc/mir/interpret/error.rs @@ -182,7 +182,7 @@ pub fn struct_error<'a, 'gcx, 'tcx>( #[derive(Debug, Clone)] pub struct EvalError<'tcx> { pub kind: InterpError<'tcx, u64>, - pub backtrace: Option>, + backtrace: Option>, } impl<'tcx> EvalError<'tcx> { From 524f1463cd6b0025d77f34e6911bce6e37c3e8ea Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 7 Jun 2019 15:51:29 +0200 Subject: [PATCH 2/2] add doc comment for EvalError --- src/librustc/mir/interpret/error.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/librustc/mir/interpret/error.rs b/src/librustc/mir/interpret/error.rs index 83204dcf62bac..e324abd8e2f32 100644 --- a/src/librustc/mir/interpret/error.rs +++ b/src/librustc/mir/interpret/error.rs @@ -179,6 +179,11 @@ 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>,