Skip to content

Commit

Permalink
Rollup merge of rust-lang#91425 - jyn514:treat-lint-err-as-bug, r=oli…
Browse files Browse the repository at this point in the history
…-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`
  • Loading branch information
matthiaskrgr committed Dec 1, 2021
2 parents 5fb1886 + 9de8a4a commit 4a6e8a9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions compiler/rustc_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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!(
Expand Down

0 comments on commit 4a6e8a9

Please sign in to comment.