Report number of delayed bugs properly with -Ztreat-err-as-bug
This commit is contained in:
parent
b44197abb0
commit
38935bbe6a
1 changed files with 22 additions and 17 deletions
|
@ -1250,14 +1250,14 @@ impl HandlerInner {
|
||||||
|
|
||||||
fn treat_err_as_bug(&self) -> bool {
|
fn treat_err_as_bug(&self) -> bool {
|
||||||
self.flags.treat_err_as_bug.map_or(false, |c| {
|
self.flags.treat_err_as_bug.map_or(false, |c| {
|
||||||
self.err_count()
|
self.err_count() + self.lint_err_count + self.delayed_bug_count() >= c.get()
|
||||||
+ self.lint_err_count
|
|
||||||
+ self.delayed_span_bugs.len()
|
|
||||||
+ self.delayed_good_path_bugs.len()
|
|
||||||
>= c.get()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn delayed_bug_count(&self) -> usize {
|
||||||
|
self.delayed_span_bugs.len() + self.delayed_good_path_bugs.len()
|
||||||
|
}
|
||||||
|
|
||||||
fn print_error_count(&mut self, registry: &Registry) {
|
fn print_error_count(&mut self, registry: &Registry) {
|
||||||
self.emit_stashed_diagnostics();
|
self.emit_stashed_diagnostics();
|
||||||
|
|
||||||
|
@ -1412,12 +1412,7 @@ impl HandlerInner {
|
||||||
// incrementing `err_count` by one, so we need to +1 the comparing.
|
// incrementing `err_count` by one, so we need to +1 the comparing.
|
||||||
// FIXME: Would be nice to increment err_count in a more coherent way.
|
// FIXME: Would be nice to increment err_count in a more coherent way.
|
||||||
if self.flags.treat_err_as_bug.map_or(false, |c| {
|
if self.flags.treat_err_as_bug.map_or(false, |c| {
|
||||||
self.err_count()
|
self.err_count() + self.lint_err_count + self.delayed_bug_count() + 1 >= c.get()
|
||||||
+ self.lint_err_count
|
|
||||||
+ self.delayed_span_bugs.len()
|
|
||||||
+ self.delayed_good_path_bugs.len()
|
|
||||||
+ 1
|
|
||||||
>= c.get()
|
|
||||||
}) {
|
}) {
|
||||||
// FIXME: don't abort here if report_delayed_bugs is off
|
// FIXME: don't abort here if report_delayed_bugs is off
|
||||||
self.span_bug(sp, msg);
|
self.span_bug(sp, msg);
|
||||||
|
@ -1518,14 +1513,24 @@ impl HandlerInner {
|
||||||
if self.treat_err_as_bug() {
|
if self.treat_err_as_bug() {
|
||||||
match (
|
match (
|
||||||
self.err_count() + self.lint_err_count,
|
self.err_count() + self.lint_err_count,
|
||||||
|
self.delayed_bug_count(),
|
||||||
self.flags.treat_err_as_bug.map(|c| c.get()).unwrap_or(0),
|
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`"),
|
(1, 0, 1) => panic!("aborting due to `-Z treat-err-as-bug=1`"),
|
||||||
(0 | 1, _) => {}
|
(0, 1, 1) => panic!("aborting due delayed bug with `-Z treat-err-as-bug=1`"),
|
||||||
(count, as_bug) => panic!(
|
(count, delayed_count, as_bug) => {
|
||||||
"aborting after {} errors due to `-Z treat-err-as-bug={}`",
|
if delayed_count > 0 {
|
||||||
count, as_bug,
|
panic!(
|
||||||
),
|
"aborting after {} errors and {} delayed bugs due to `-Z treat-err-as-bug={}`",
|
||||||
|
count, delayed_count, as_bug,
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
panic!(
|
||||||
|
"aborting after {} errors due to `-Z treat-err-as-bug={}`",
|
||||||
|
count, as_bug,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue