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 @@ impl<'a> DiagCtxtHandle<'a> {
|
|||||||
self.inner.borrow_mut().emit_stashed_diagnostics()
|
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.
|
/// This excludes delayed bugs.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn err_count(&self) -> usize {
|
pub fn err_count(&self) -> usize {
|
||||||
|
@ -82,7 +82,6 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||||||
reported_trait_errors: self.reported_trait_errors.clone(),
|
reported_trait_errors: self.reported_trait_errors.clone(),
|
||||||
reported_signature_mismatch: self.reported_signature_mismatch.clone(),
|
reported_signature_mismatch: self.reported_signature_mismatch.clone(),
|
||||||
tainted_by_errors: self.tainted_by_errors.clone(),
|
tainted_by_errors: self.tainted_by_errors.clone(),
|
||||||
err_count_on_creation: self.err_count_on_creation,
|
|
||||||
universe: self.universe.clone(),
|
universe: self.universe.clone(),
|
||||||
intercrate,
|
intercrate,
|
||||||
next_trait_solver: self.next_trait_solver,
|
next_trait_solver: self.next_trait_solver,
|
||||||
|
@ -279,27 +279,14 @@ pub struct InferCtxt<'tcx> {
|
|||||||
pub reported_signature_mismatch: RefCell<FxHashSet<(Span, Option<Span>)>>,
|
pub reported_signature_mismatch: RefCell<FxHashSet<(Span, Option<Span>)>>,
|
||||||
|
|
||||||
/// When an error occurs, we want to avoid reporting "derived"
|
/// When an error occurs, we want to avoid reporting "derived"
|
||||||
/// errors that are due to this original failure. Normally, we
|
/// errors that are due to this original failure. We have this
|
||||||
/// handle this with the `err_count_on_creation` count, which
|
/// flag that one can set whenever one creates a type-error that
|
||||||
/// basically just tracks how many errors were reported when we
|
/// is due to an error in a prior pass.
|
||||||
/// 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.
|
|
||||||
///
|
///
|
||||||
/// Don't read this flag directly, call `is_tainted_by_errors()`
|
/// Don't read this flag directly, call `is_tainted_by_errors()`
|
||||||
/// and `set_tainted_by_errors()`.
|
/// and `set_tainted_by_errors()`.
|
||||||
tainted_by_errors: Cell<Option<ErrorGuaranteed>>,
|
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
|
/// What is the innermost universe we have created? Starts out as
|
||||||
/// `UniverseIndex::root()` but grows from there as we enter
|
/// `UniverseIndex::root()` but grows from there as we enter
|
||||||
/// universal quantifiers.
|
/// universal quantifiers.
|
||||||
@ -656,7 +643,6 @@ impl<'tcx> InferCtxtBuilder<'tcx> {
|
|||||||
reported_trait_errors: Default::default(),
|
reported_trait_errors: Default::default(),
|
||||||
reported_signature_mismatch: Default::default(),
|
reported_signature_mismatch: Default::default(),
|
||||||
tainted_by_errors: Cell::new(None),
|
tainted_by_errors: Cell::new(None),
|
||||||
err_count_on_creation: tcx.dcx().err_count_excluding_lint_errs(),
|
|
||||||
universe: Cell::new(ty::UniverseIndex::ROOT),
|
universe: Cell::new(ty::UniverseIndex::ROOT),
|
||||||
intercrate,
|
intercrate,
|
||||||
next_trait_solver,
|
next_trait_solver,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user