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".
This commit is contained in:
Nicholas Nethercote 2024-01-10 14:29:01 +11:00
parent f0a3684c1e
commit 2aac288c18
6 changed files with 6 additions and 6 deletions

View File

@ -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;
}

View File

@ -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()

View File

@ -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;

View File

@ -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>>;

View File

@ -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; }

View File

@ -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;