diff options
| author | Boxy <supbscripter@gmail.com> | 2022-11-24 11:12:34 +0000 |
|---|---|---|
| committer | Boxy <supbscripter@gmail.com> | 2022-11-24 11:12:46 +0000 |
| commit | 72d8879c29570ee18cc3ab2c3e96bfd97221d0bb (patch) | |
| tree | aa5db5c888d1e5da5df848167835b6c56214ba5d /compiler/rustc_errors/src/lib.rs | |
| parent | 4e0d0d757e2f1b61ec809420b006545a9f8974c0 (diff) | |
| download | rust-72d8879c29570ee18cc3ab2c3e96bfd97221d0bb.tar.gz rust-72d8879c29570ee18cc3ab2c3e96bfd97221d0bb.zip | |
make `error_reported` check for delayed bugs
Diffstat (limited to 'compiler/rustc_errors/src/lib.rs')
| -rw-r--r-- | compiler/rustc_errors/src/lib.rs | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index f8747386c04..2be36a6eeb4 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -1044,13 +1044,24 @@ impl Handler { } pub fn has_errors_or_lint_errors(&self) -> Option<ErrorGuaranteed> { if self.inner.borrow().has_errors_or_lint_errors() { - Some(ErrorGuaranteed(())) + Some(ErrorGuaranteed::unchecked_claim_error_was_emitted()) + } else { + None + } + } + pub fn has_errors_or_delayed_span_bugs(&self) -> Option<ErrorGuaranteed> { + if self.inner.borrow().has_errors_or_delayed_span_bugs() { + Some(ErrorGuaranteed::unchecked_claim_error_was_emitted()) } else { None } } - pub fn has_errors_or_delayed_span_bugs(&self) -> bool { - self.inner.borrow().has_errors_or_delayed_span_bugs() + pub fn is_compilation_going_to_fail(&self) -> Option<ErrorGuaranteed> { + if self.inner.borrow().is_compilation_going_to_fail() { + Some(ErrorGuaranteed::unchecked_claim_error_was_emitted()) + } else { + None + } } pub fn print_error_count(&self, registry: &Registry) { @@ -1484,6 +1495,10 @@ impl HandlerInner { self.err_count() > 0 || self.lint_err_count > 0 || self.warn_count > 0 } + fn is_compilation_going_to_fail(&self) -> bool { + self.has_errors() || self.lint_err_count > 0 || !self.delayed_span_bugs.is_empty() + } + fn abort_if_errors(&mut self) { self.emit_stashed_diagnostics(); |
