Skip to content

Commit bd7cd80

Browse files
authored
Fully clear HandlerInner in Handler::reset_err_count
1 parent 702b45e commit bd7cd80

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/librustc_errors/lib.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -469,14 +469,17 @@ impl Handler {
469469
/// NOTE: *do not* call this function from rustc. It is only meant to be called from external
470470
/// tools that want to reuse a `Parser` cleaning the previously emitted diagnostics as well as
471471
/// the overall count of emitted error diagnostics.
472-
// FIXME: this does not clear inner entirely
473472
pub fn reset_err_count(&self) {
474473
let mut inner = self.inner.borrow_mut();
475-
// actually frees the underlying memory (which `clear` would not do)
476-
inner.emitted_diagnostics = Default::default();
477-
inner.deduplicated_err_count = 0;
478474
inner.err_count = 0;
479-
inner.stashed_diagnostics.clear();
475+
inner.deduplicated_err_count = 0;
476+
477+
// actually free the underlying memory (which `clear` would not do)
478+
inner.delayed_span_bugs = Default::default();
479+
inner.taught_diagnostics = Default::default();
480+
inner.emitted_diagnostic_codes = Default::default();
481+
inner.emitted_diagnostics = Default::default();
482+
inner.stashed_diagnostics = Default::default();
480483
}
481484

482485
/// Stash a given diagnostic with the given `Span` and `StashKey` as the key for later stealing.

0 commit comments

Comments
 (0)