about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-12-01 20:14:07 +0000
committerbors <bors@rust-lang.org>2021-12-01 20:14:07 +0000
commit48a5999fceeea84a8971634355287faa349909d4 (patch)
tree9ad663ffaf4c2f4fa545f7123dc7b3bba066ff2d /compiler/rustc_errors/src
parent3c51718ae7ae3160058e220b879d2a69533973a7 (diff)
parent4ae75cfa2e01f383ba610038aca2356197f8ac75 (diff)
downloadrust-48a5999fceeea84a8971634355287faa349909d4.tar.gz
rust-48a5999fceeea84a8971634355287faa349909d4.zip
Auto merge of #91433 - matthiaskrgr:rollup-118ql06, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #88502 (Add slice take methods)
 - #91313 (expand: Turn `ast::Crate` into a first class expansion target)
 - #91424 (Update LLVM with patches for better llvm-cov diagnostics)
 - #91425 (Include lint errors in error count for `-Ztreat-err-as-bug`)
 - #91430 (Add tests for `normalize-docs` overflow errors)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_errors/src')
-rw-r--r--compiler/rustc_errors/src/lib.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs
index bb3d3a415e7..82a02c3e543 100644
--- a/compiler/rustc_errors/src/lib.rs
+++ b/compiler/rustc_errors/src/lib.rs
@@ -1013,7 +1013,9 @@ impl HandlerInner {
     }
 
     fn treat_err_as_bug(&self) -> bool {
-        self.flags.treat_err_as_bug.map_or(false, |c| self.err_count() >= c.get())
+        self.flags
+            .treat_err_as_bug
+            .map_or(false, |c| self.err_count() + self.lint_err_count >= c.get())
     }
 
     fn print_error_count(&mut self, registry: &Registry) {
@@ -1205,7 +1207,10 @@ impl HandlerInner {
 
     fn panic_if_treat_err_as_bug(&self) {
         if self.treat_err_as_bug() {
-            match (self.err_count(), self.flags.treat_err_as_bug.map(|c| c.get()).unwrap_or(0)) {
+            match (
+                self.err_count() + self.lint_err_count,
+                self.flags.treat_err_as_bug.map(|c| c.get()).unwrap_or(0),
+            ) {
                 (1, 1) => panic!("aborting due to `-Z treat-err-as-bug=1`"),
                 (0, _) | (1, _) => {}
                 (count, as_bug) => panic!(