Skip to content

Commit 4a6e8a9

Browse files
authored
Rollup merge of rust-lang#91425 - jyn514:treat-lint-err-as-bug, r=oli-obk
Include lint errors in error count for `-Ztreat-err-as-bug` This was a regression from rust-lang#87337; the `panic_if_treat_err_as_bug` function only checked the number of hard errors, not the number of lint errors. r? `@oli-obk`
2 parents 5fb1886 + 9de8a4a commit 4a6e8a9

File tree

1 file changed

+7
-2
lines changed
  • compiler/rustc_errors/src

1 file changed

+7
-2
lines changed

compiler/rustc_errors/src/lib.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,9 @@ impl HandlerInner {
10131013
}
10141014

10151015
fn treat_err_as_bug(&self) -> bool {
1016-
self.flags.treat_err_as_bug.map_or(false, |c| self.err_count() >= c.get())
1016+
self.flags
1017+
.treat_err_as_bug
1018+
.map_or(false, |c| self.err_count() + self.lint_err_count >= c.get())
10171019
}
10181020

10191021
fn print_error_count(&mut self, registry: &Registry) {
@@ -1205,7 +1207,10 @@ impl HandlerInner {
12051207

12061208
fn panic_if_treat_err_as_bug(&self) {
12071209
if self.treat_err_as_bug() {
1208-
match (self.err_count(), self.flags.treat_err_as_bug.map(|c| c.get()).unwrap_or(0)) {
1210+
match (
1211+
self.err_count() + self.lint_err_count,
1212+
self.flags.treat_err_as_bug.map(|c| c.get()).unwrap_or(0),
1213+
) {
12091214
(1, 1) => panic!("aborting due to `-Z treat-err-as-bug=1`"),
12101215
(0, _) | (1, _) => {}
12111216
(count, as_bug) => panic!(

0 commit comments

Comments
 (0)