Mark ErrorGuaranteed constructor as deprecated so people don't use it

This commit is contained in:
Michael Goulet 2023-05-05 17:31:54 +00:00
parent 82cd953c7c
commit 6077fdd219
6 changed files with 35 additions and 16 deletions

View file

@ -192,6 +192,7 @@ impl EmissionGuarantee for ErrorGuaranteed {
became non-error ({:?}), after original `.emit()`",
db.inner.diagnostic.level,
);
#[allow(deprecated)]
ErrorGuaranteed::unchecked_claim_error_was_emitted()
}
}

View file

@ -1069,26 +1069,29 @@ impl Handler {
}
pub fn has_errors(&self) -> Option<ErrorGuaranteed> {
self.inner.borrow().has_errors().then(ErrorGuaranteed::unchecked_claim_error_was_emitted)
self.inner.borrow().has_errors().then(|| {
#[allow(deprecated)]
ErrorGuaranteed::unchecked_claim_error_was_emitted()
})
}
pub fn has_errors_or_lint_errors(&self) -> Option<ErrorGuaranteed> {
self.inner
.borrow()
.has_errors_or_lint_errors()
.then(ErrorGuaranteed::unchecked_claim_error_was_emitted)
self.inner.borrow().has_errors_or_lint_errors().then(|| {
#[allow(deprecated)]
ErrorGuaranteed::unchecked_claim_error_was_emitted()
})
}
pub fn has_errors_or_delayed_span_bugs(&self) -> Option<ErrorGuaranteed> {
self.inner
.borrow()
.has_errors_or_delayed_span_bugs()
.then(ErrorGuaranteed::unchecked_claim_error_was_emitted)
self.inner.borrow().has_errors_or_delayed_span_bugs().then(|| {
#[allow(deprecated)]
ErrorGuaranteed::unchecked_claim_error_was_emitted()
})
}
pub fn is_compilation_going_to_fail(&self) -> Option<ErrorGuaranteed> {
self.inner
.borrow()
.is_compilation_going_to_fail()
.then(ErrorGuaranteed::unchecked_claim_error_was_emitted)
self.inner.borrow().is_compilation_going_to_fail().then(|| {
#[allow(deprecated)]
ErrorGuaranteed::unchecked_claim_error_was_emitted()
})
}
pub fn print_error_count(&self, registry: &Registry) {
@ -1333,6 +1336,7 @@ impl HandlerInner {
.push(DelayedDiagnostic::with_backtrace(diagnostic.clone(), backtrace));
if !self.flags.report_delayed_bugs {
#[allow(deprecated)]
return Some(ErrorGuaranteed::unchecked_claim_error_was_emitted());
}
}
@ -1411,7 +1415,10 @@ impl HandlerInner {
self.bump_err_count();
}
guaranteed = Some(ErrorGuaranteed::unchecked_claim_error_was_emitted());
#[allow(deprecated)]
{
guaranteed = Some(ErrorGuaranteed::unchecked_claim_error_was_emitted());
}
} else {
self.bump_warn_count();
}