diff options
| author | bors <bors@rust-lang.org> | 2024-01-11 20:01:01 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-01-11 20:01:01 +0000 |
| commit | 62d7ed4a6775c4490e493093ca98ef7c215b835b (patch) | |
| tree | cd2c1a220226731839eb3485268861de65a162c8 /compiler/rustc_errors/src/lib.rs | |
| parent | 4d31ed4cdbcf4a0441f5b0d4e8f6cc3bb875b5b4 (diff) | |
| parent | b3d15ebb08ddeecbdcb92e5f2121975a54b901ad (diff) | |
| download | rust-62d7ed4a6775c4490e493093ca98ef7c215b835b.tar.gz rust-62d7ed4a6775c4490e493093ca98ef7c215b835b.zip | |
Auto merge of #119864 - matthiaskrgr:rollup-mc2qz13, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #119448 (annotate-snippets: update to 0.10) - #119813 (Silence some follow-up errors [2/x]) - #119836 (chore: remove unnecessary blank line) - #119841 (Remove `DiagnosticBuilder::buffer`) - #119842 (coverage: Add enums to accommodate other kinds of coverage mappings) - #119845 (rint: further doc tweaks) - #119852 (give const-err4 a more descriptive name) - #119853 (rustfmt.toml: don't ignore just any tests path, only root one) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_errors/src/lib.rs')
| -rw-r--r-- | compiler/rustc_errors/src/lib.rs | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 8fb539fc358..404c89ea01b 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -981,6 +981,10 @@ impl DiagCtxt { inner.emit_stashed_diagnostics(); + if inner.treat_err_as_bug() { + return; + } + let warnings = match inner.deduplicated_warn_count { 0 => Cow::from(""), 1 => Cow::from("1 warning emitted"), @@ -991,9 +995,6 @@ impl DiagCtxt { 1 => Cow::from("aborting due to 1 previous error"), count => Cow::from(format!("aborting due to {count} previous errors")), }; - if inner.treat_err_as_bug() { - return; - } match (errors.len(), warnings.len()) { (0, 0) => return, @@ -1168,7 +1169,8 @@ impl DiagCtxt { let mut inner = self.inner.borrow_mut(); if loud && lint_level.is_error() { - inner.bump_err_count(); + inner.err_count += 1; + inner.panic_if_treat_err_as_bug(); } inner.emitter.emit_unused_externs(lint_level, unused_externs) @@ -1255,7 +1257,7 @@ impl DiagCtxtInner { } fn emit_diagnostic(&mut self, mut diagnostic: Diagnostic) -> Option<ErrorGuaranteed> { - if matches!(diagnostic.level, Error | Fatal) && self.treat_err_as_bug() { + if matches!(diagnostic.level, Error | Fatal) && self.treat_next_err_as_bug() { diagnostic.level = Bug; } @@ -1353,10 +1355,11 @@ impl DiagCtxtInner { } if diagnostic.is_error() { if diagnostic.is_lint { - self.bump_lint_err_count(); + self.lint_err_count += 1; } else { - self.bump_err_count(); + self.err_count += 1; } + self.panic_if_treat_err_as_bug(); #[allow(deprecated)] { @@ -1447,16 +1450,6 @@ impl DiagCtxtInner { panic::panic_any(DelayedBugPanic); } - fn bump_lint_err_count(&mut self) { - self.lint_err_count += 1; - self.panic_if_treat_err_as_bug(); - } - - fn bump_err_count(&mut self) { - self.err_count += 1; - self.panic_if_treat_err_as_bug(); - } - fn panic_if_treat_err_as_bug(&self) { if self.treat_err_as_bug() { match ( |
