Skip to content

Commit 25d1ef1

Browse files
committed
Remove InferCtxt::err_count_on_creation.
It's no longer used meaningfully. This also means `DiagCtxtHandle::err_count_excluding_lint_errs` can be removed.
1 parent 2d2755f commit 25d1ef1

File tree

3 files changed

+3
-30
lines changed

3 files changed

+3
-30
lines changed

compiler/rustc_errors/src/lib.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -925,18 +925,6 @@ impl<'a> DiagCtxtHandle<'a> {
925925
self.inner.borrow_mut().emit_stashed_diagnostics()
926926
}
927927

928-
/// This excludes lint errors, and delayed bugs.
929-
#[inline]
930-
pub fn err_count_excluding_lint_errs(&self) -> usize {
931-
let inner = self.inner.borrow();
932-
inner.err_guars.len()
933-
+ inner
934-
.stashed_diagnostics
935-
.values()
936-
.filter(|(diag, guar)| guar.is_some() && diag.is_lint.is_none())
937-
.count()
938-
}
939-
940928
/// This excludes delayed bugs.
941929
#[inline]
942930
pub fn err_count(&self) -> usize {

compiler/rustc_infer/src/infer/at.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ impl<'tcx> InferCtxt<'tcx> {
8282
reported_trait_errors: self.reported_trait_errors.clone(),
8383
reported_signature_mismatch: self.reported_signature_mismatch.clone(),
8484
tainted_by_errors: self.tainted_by_errors.clone(),
85-
err_count_on_creation: self.err_count_on_creation,
8685
universe: self.universe.clone(),
8786
intercrate,
8887
next_trait_solver: self.next_trait_solver,

compiler/rustc_infer/src/infer/mod.rs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -279,27 +279,14 @@ pub struct InferCtxt<'tcx> {
279279
pub reported_signature_mismatch: RefCell<FxHashSet<(Span, Option<Span>)>>,
280280

281281
/// When an error occurs, we want to avoid reporting "derived"
282-
/// errors that are due to this original failure. Normally, we
283-
/// handle this with the `err_count_on_creation` count, which
284-
/// basically just tracks how many errors were reported when we
285-
/// started type-checking a fn and checks to see if any new errors
286-
/// have been reported since then. Not great, but it works.
287-
///
288-
/// However, when errors originated in other passes -- notably
289-
/// resolve -- this heuristic breaks down. Therefore, we have this
290-
/// auxiliary flag that one can set whenever one creates a
291-
/// type-error that is due to an error in a prior pass.
282+
/// errors that are due to this original failure. We have this
283+
/// flag that one can set whenever one creates a type-error that
284+
/// is due to an error in a prior pass.
292285
///
293286
/// Don't read this flag directly, call `is_tainted_by_errors()`
294287
/// and `set_tainted_by_errors()`.
295288
tainted_by_errors: Cell<Option<ErrorGuaranteed>>,
296289

297-
/// Track how many errors were reported when this infcx is created.
298-
/// If the number of errors increases, that's also a sign (like
299-
/// `tainted_by_errors`) to avoid reporting certain kinds of errors.
300-
// FIXME(matthewjasper) Merge into `tainted_by_errors`
301-
err_count_on_creation: usize,
302-
303290
/// What is the innermost universe we have created? Starts out as
304291
/// `UniverseIndex::root()` but grows from there as we enter
305292
/// universal quantifiers.
@@ -656,7 +643,6 @@ impl<'tcx> InferCtxtBuilder<'tcx> {
656643
reported_trait_errors: Default::default(),
657644
reported_signature_mismatch: Default::default(),
658645
tainted_by_errors: Cell::new(None),
659-
err_count_on_creation: tcx.dcx().err_count_excluding_lint_errs(),
660646
universe: Cell::new(ty::UniverseIndex::ROOT),
661647
intercrate,
662648
next_trait_solver,

0 commit comments

Comments
 (0)