summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src/interpret
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2022-09-21 13:05:20 +0200
committerRalf Jung <post@ralfj.de>2022-10-07 18:08:49 +0200
commitfd59d44f5880fea109fe68e31fab2486cd686fc6 (patch)
tree3eef90caf77fefc09fc993e511f9a9b8f5470cb2 /compiler/rustc_const_eval/src/interpret
parent58546803885164d488185fb9cb9fb04fcbe64e30 (diff)
downloadrust-fd59d44f5880fea109fe68e31fab2486cd686fc6.tar.gz
rust-fd59d44f5880fea109fe68e31fab2486cd686fc6.zip
make const_err a hard error
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret')
-rw-r--r--compiler/rustc_const_eval/src/interpret/eval_context.rs3
-rw-r--r--compiler/rustc_const_eval/src/interpret/intern.rs2
2 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/eval_context.rs b/compiler/rustc_const_eval/src/interpret/eval_context.rs
index bdebfbb3ff5..d2e0a0dd240 100644
--- a/compiler/rustc_const_eval/src/interpret/eval_context.rs
+++ b/compiler/rustc_const_eval/src/interpret/eval_context.rs
@@ -258,6 +258,9 @@ impl<'tcx> fmt::Display for FrameInfo<'tcx> {
             {
                 write!(f, "inside closure")?;
             } else {
+                // Note: this triggers a `good_path_bug` state, which means that if we ever get here
+                // we must emit a diagnostic. We should never display a `FrameInfo` unless we
+                // actually want to emit a warning or error to the user.
                 write!(f, "inside `{}`", self.instance)?;
             }
             if !self.span.is_dummy() {
diff --git a/compiler/rustc_const_eval/src/interpret/intern.rs b/compiler/rustc_const_eval/src/interpret/intern.rs
index 24dbc769529..f72ae7413e3 100644
--- a/compiler/rustc_const_eval/src/interpret/intern.rs
+++ b/compiler/rustc_const_eval/src/interpret/intern.rs
@@ -332,8 +332,6 @@ pub enum InternKind {
 ///
 /// This *cannot raise an interpreter error*.  Doing so is left to validation, which
 /// tracks where in the value we are and thus can show much better error messages.
-/// Any errors here would anyway be turned into `const_err` lints, whereas validation failures
-/// are hard errors.
 #[instrument(level = "debug", skip(ecx))]
 pub fn intern_const_alloc_recursive<
     'mir,