Skip to content

Commit 64a21f8

Browse files
author
Ariel Ben-Yehuda
authored
Rollup merge of rust-lang#43778 - topecongiro:handler-reset-err-count, r=arielb1
Add reset_err_count() to errors::Handler The motivation here is to allow rustfmt to recover from parse errors after failing to parse macros (cc rust-lang/rustfmt#1742). r? @nrc
2 parents 11e75fd + 601e3da commit 64a21f8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/librustc_errors/lib.rs

+6
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,12 @@ impl Handler {
306306
self.continue_after_error.set(continue_after_error);
307307
}
308308

309+
// NOTE: DO NOT call this function from rustc, as it relies on `err_count` being non-zero
310+
// if an error happened to avoid ICEs. This function should only be called from tools.
311+
pub fn reset_err_count(&self) {
312+
self.err_count.set(0);
313+
}
314+
309315
pub fn struct_dummy<'a>(&'a self) -> DiagnosticBuilder<'a> {
310316
DiagnosticBuilder::new(self, Level::Cancelled, "")
311317
}

0 commit comments

Comments
 (0)