diff options
| author | bors <bors@rust-lang.org> | 2022-09-06 18:10:14 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-09-06 18:10:14 +0000 |
| commit | 78a891d364a7358ed9eb9c93099ba2f3e6817ca6 (patch) | |
| tree | 70b18f31803977bff2e445b6c26fa7c8e0aba8e5 /compiler/rustc_errors/src | |
| parent | 380addd7d2971447d7f6828c508a93fa8018a9b6 (diff) | |
| parent | f21b6129a018a5c55b48bad83f50730eca03d02d (diff) | |
| download | rust-78a891d364a7358ed9eb9c93099ba2f3e6817ca6.tar.gz rust-78a891d364a7358ed9eb9c93099ba2f3e6817ca6.zip | |
Auto merge of #101485 - GuillaumeGomez:rollup-68p9di4, r=GuillaumeGomez
Rollup of 7 pull requests Successful merges: - #101357 (Include enum path in variant suggestion) - #101434 (Update `SessionDiagnostic::into_diagnostic` to take `Handler` instead of `ParseSess`) - #101445 (Suggest introducing an explicit lifetime if it does not exist) - #101457 (Recover from using `;` as separator between fields) - #101462 (Rustdoc-Json: Store Variant Fields as their own item.) - #101471 (Report number of delayed bugs properly with `-Ztreat-err-as-bug`) - #101473 (Add more size assertions for MIR types.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/lib.rs | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 68abdd0bad1..37ff6dcff7d 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -1250,14 +1250,14 @@ impl HandlerInner { fn treat_err_as_bug(&self) -> bool { self.flags.treat_err_as_bug.map_or(false, |c| { - self.err_count() - + self.lint_err_count - + self.delayed_span_bugs.len() - + self.delayed_good_path_bugs.len() - >= c.get() + self.err_count() + self.lint_err_count + self.delayed_bug_count() >= 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) { self.emit_stashed_diagnostics(); @@ -1412,12 +1412,7 @@ impl HandlerInner { // 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. if self.flags.treat_err_as_bug.map_or(false, |c| { - self.err_count() - + self.lint_err_count - + self.delayed_span_bugs.len() - + self.delayed_good_path_bugs.len() - + 1 - >= c.get() + self.err_count() + self.lint_err_count + self.delayed_bug_count() + 1 >= c.get() }) { // FIXME: don't abort here if report_delayed_bugs is off self.span_bug(sp, msg); @@ -1518,14 +1513,24 @@ impl HandlerInner { if self.treat_err_as_bug() { match ( self.err_count() + self.lint_err_count, + self.delayed_bug_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!( - "aborting after {} errors due to `-Z treat-err-as-bug={}`", - count, as_bug, - ), + (1, 0, 1) => panic!("aborting due to `-Z treat-err-as-bug=1`"), + (0, 1, 1) => panic!("aborting due delayed bug with `-Z treat-err-as-bug=1`"), + (count, delayed_count, as_bug) => { + if delayed_count > 0 { + 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, + ) + } + } } } } |
