summary refs log tree commit diff
path: root/compiler/rustc_errors/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-01-10 14:29:01 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2024-01-11 16:55:10 +1100
commit2aac288c18f96c55677d90262e068820caf310f3 (patch)
tree0e55f1b7b9dfbf80656d66c2ee52ad48b7011191 /compiler/rustc_errors/src
parentf0a3684c1e792b6c16e32dc154de34328beef619 (diff)
downloadrust-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".
Diffstat (limited to 'compiler/rustc_errors/src')
-rw-r--r--compiler/rustc_errors/src/lib.rs2
1 files changed, 1 insertions, 1 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;
         }