diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-01-10 14:29:01 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-01-11 16:55:10 +1100 |
| commit | 2aac288c18f96c55677d90262e068820caf310f3 (patch) | |
| tree | 0e55f1b7b9dfbf80656d66c2ee52ad48b7011191 | |
| parent | f0a3684c1e792b6c16e32dc154de34328beef619 (diff) | |
| download | rust-2aac288c18f96c55677d90262e068820caf310f3.tar.gz rust-2aac288c18f96c55677d90262e068820caf310f3.zip | |
Use the right level with `-Ztreat-err-as-bug`.
Errors in `DiagCtxtInner::emit_diagnostic` are never set to `Level::Bug`, because the condition never succeeds, because `self.treat_err_as_bug()` is called *before* the error counts are incremented. This commit switches to `self.treat_next_err_as_bug()`, fixing the problem. This changes the error message output to actually say "internal compiler error".
| -rw-r--r-- | compiler/rustc_errors/src/lib.rs | 2 | ||||
| -rw-r--r-- | tests/rustdoc-ui/ice-bug-report-url.stderr | 2 | ||||
| -rw-r--r-- | tests/ui/consts/const-eval/const-eval-query-stack.stderr | 2 | ||||
| -rw-r--r-- | tests/ui/impl-trait/issues/issue-86800.stderr | 2 | ||||
| -rw-r--r-- | tests/ui/panics/default-backtrace-ice.stderr | 2 | ||||
| -rw-r--r-- | tests/ui/treat-err-as-bug/err.stderr | 2 |
6 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index b2b74c7195a..e60300bc3eb 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -1256,7 +1256,7 @@ impl DiagCtxtInner { } fn emit_diagnostic(&mut self, mut diagnostic: Diagnostic) -> Option<ErrorGuaranteed> { - if matches!(diagnostic.level, Error | Fatal) && self.treat_err_as_bug() { + if matches!(diagnostic.level, Error | Fatal) && self.treat_next_err_as_bug() { diagnostic.level = Bug; } diff --git a/tests/rustdoc-ui/ice-bug-report-url.stderr b/tests/rustdoc-ui/ice-bug-report-url.stderr index 869fcd20fac..06a52691310 100644 --- a/tests/rustdoc-ui/ice-bug-report-url.stderr +++ b/tests/rustdoc-ui/ice-bug-report-url.stderr @@ -1,4 +1,4 @@ -error: expected one of `->`, `where`, or `{`, found `<eof>` +error: internal compiler error: expected one of `->`, `where`, or `{`, found `<eof>` --> $DIR/ice-bug-report-url.rs:14:10 | LL | fn wrong() diff --git a/tests/ui/consts/const-eval/const-eval-query-stack.stderr b/tests/ui/consts/const-eval/const-eval-query-stack.stderr index 01fb8153cf3..c748af608d1 100644 --- a/tests/ui/consts/const-eval/const-eval-query-stack.stderr +++ b/tests/ui/consts/const-eval/const-eval-query-stack.stderr @@ -1,4 +1,4 @@ -error[E0080]: evaluation of constant value failed +error: internal compiler error[E0080]: evaluation of constant value failed --> $DIR/const-eval-query-stack.rs:16:16 | LL | const X: i32 = 1 / 0; diff --git a/tests/ui/impl-trait/issues/issue-86800.stderr b/tests/ui/impl-trait/issues/issue-86800.stderr index 07ba8eb021b..7af4846a959 100644 --- a/tests/ui/impl-trait/issues/issue-86800.stderr +++ b/tests/ui/impl-trait/issues/issue-86800.stderr @@ -4,7 +4,7 @@ error: unconstrained opaque type LL | type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResult<O>>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -error[E0792]: expected generic lifetime parameter, found `'_` +error: internal compiler error[E0792]: expected generic lifetime parameter, found `'_` --> $DIR/issue-86800.rs:39:5 | LL | type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResult<O>>; diff --git a/tests/ui/panics/default-backtrace-ice.stderr b/tests/ui/panics/default-backtrace-ice.stderr index 4b00f135047..9d27cb22ae9 100644 --- a/tests/ui/panics/default-backtrace-ice.stderr +++ b/tests/ui/panics/default-backtrace-ice.stderr @@ -1,4 +1,4 @@ -error[E0425]: cannot find value `missing_ident` in this scope +error: internal compiler error[E0425]: cannot find value `missing_ident` in this scope --> $DIR/default-backtrace-ice.rs:21:13 | LL | fn main() { missing_ident; } diff --git a/tests/ui/treat-err-as-bug/err.stderr b/tests/ui/treat-err-as-bug/err.stderr index 3a56445a26b..4c5d0e5ae79 100644 --- a/tests/ui/treat-err-as-bug/err.stderr +++ b/tests/ui/treat-err-as-bug/err.stderr @@ -1,4 +1,4 @@ -error[E0080]: could not evaluate static initializer +error: internal compiler error[E0080]: could not evaluate static initializer --> $DIR/err.rs:11:21 | LL | pub static C: u32 = 0 - 1; |
