From 6b22a42e011c425016a5d2ce4d93b6962c07837c Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Wed, 1 Dec 2021 16:32:55 +0000 Subject: [PATCH] Include lint errors in error count for `-Ztreat-err-as-bug` This was a regression from https://github.com/rust-lang/rust/pull/87337; the `panic_if_treat_err_as_bug` function only checked the number of hard errors, not the number of lint errors. --- compiler/rustc_errors/src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index bb3d3a415e7d5..ea147d6624ddc 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -1205,7 +1205,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!(