Remove InferCtxt::err_count_on_creation
.
It's no longer used meaningfully. This also means `DiagCtxtHandle::err_count_excluding_lint_errs` can be removed.
This commit is contained in:
parent
2d2755ff97
commit
25d1ef1993
@ -925,18 +925,6 @@ pub fn emit_stashed_diagnostics(&self) -> Option<ErrorGuaranteed> {
|
||||
self.inner.borrow_mut().emit_stashed_diagnostics()
|
||||
}
|
||||
|
||||
/// This excludes lint errors, and delayed bugs.
|
||||
#[inline]
|
||||
pub fn err_count_excluding_lint_errs(&self) -> usize {
|
||||
let inner = self.inner.borrow();
|
||||
inner.err_guars.len()
|
||||
+ inner
|
||||
.stashed_diagnostics
|
||||
.values()
|
||||
.filter(|(diag, guar)| guar.is_some() && diag.is_lint.is_none())
|
||||
.count()
|
||||
}
|
||||
|
||||
/// This excludes delayed bugs.
|
||||
#[inline]
|
||||
pub fn err_count(&self) -> usize {
|
||||
|
@ -82,7 +82,6 @@ pub fn fork_with_intercrate(&self, intercrate: bool) -> Self {
|
||||
reported_trait_errors: self.reported_trait_errors.clone(),
|
||||
reported_signature_mismatch: self.reported_signature_mismatch.clone(),
|
||||
tainted_by_errors: self.tainted_by_errors.clone(),
|
||||
err_count_on_creation: self.err_count_on_creation,
|
||||
universe: self.universe.clone(),
|
||||
intercrate,
|
||||
next_trait_solver: self.next_trait_solver,
|
||||
|
@ -279,27 +279,14 @@ pub struct InferCtxt<'tcx> {
|
||||
pub reported_signature_mismatch: RefCell<FxHashSet<(Span, Option<Span>)>>,
|
||||
|
||||
/// When an error occurs, we want to avoid reporting "derived"
|
||||
/// errors that are due to this original failure. Normally, we
|
||||
/// handle this with the `err_count_on_creation` count, which
|
||||
/// basically just tracks how many errors were reported when we
|
||||
/// started type-checking a fn and checks to see if any new errors
|
||||
/// have been reported since then. Not great, but it works.
|
||||
///
|
||||
/// However, when errors originated in other passes -- notably
|
||||
/// resolve -- this heuristic breaks down. Therefore, we have this
|
||||
/// auxiliary flag that one can set whenever one creates a
|
||||
/// type-error that is due to an error in a prior pass.
|
||||
/// errors that are due to this original failure. We have this
|
||||
/// flag that one can set whenever one creates a type-error that
|
||||
/// is due to an error in a prior pass.
|
||||
///
|
||||
/// Don't read this flag directly, call `is_tainted_by_errors()`
|
||||
/// and `set_tainted_by_errors()`.
|
||||
tainted_by_errors: Cell<Option<ErrorGuaranteed>>,
|
||||
|
||||
/// Track how many errors were reported when this infcx is created.
|
||||
/// If the number of errors increases, that's also a sign (like
|
||||
/// `tainted_by_errors`) to avoid reporting certain kinds of errors.
|
||||
// FIXME(matthewjasper) Merge into `tainted_by_errors`
|
||||
err_count_on_creation: usize,
|
||||
|
||||
/// What is the innermost universe we have created? Starts out as
|
||||
/// `UniverseIndex::root()` but grows from there as we enter
|
||||
/// universal quantifiers.
|
||||
@ -656,7 +643,6 @@ pub fn build(&mut self) -> InferCtxt<'tcx> {
|
||||
reported_trait_errors: Default::default(),
|
||||
reported_signature_mismatch: Default::default(),
|
||||
tainted_by_errors: Cell::new(None),
|
||||
err_count_on_creation: tcx.dcx().err_count_excluding_lint_errs(),
|
||||
universe: Cell::new(ty::UniverseIndex::ROOT),
|
||||
intercrate,
|
||||
next_trait_solver,
|
||||
|
Loading…
Reference in New Issue
Block a user