Skip to content

Commit

Permalink
Add reset_err_count() to errors::Handler
Browse files Browse the repository at this point in the history
The motivation here is to allow rustfmt to recover from parse errors
after failing to parse macros.
  • Loading branch information
topecongiro committed Aug 23, 2017
1 parent f142499 commit 601e3da
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/librustc_errors/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,12 @@ impl Handler {
self.continue_after_error.set(continue_after_error);
}

// NOTE: DO NOT call this function from rustc, as it relies on `err_count` being non-zero
// if an error happened to avoid ICEs. This function should only be called from tools.
pub fn reset_err_count(&self) {
self.err_count.set(0);
}

pub fn struct_dummy<'a>(&'a self) -> DiagnosticBuilder<'a> {
DiagnosticBuilder::new(self, Level::Cancelled, "")
}
Expand Down

0 comments on commit 601e3da

Please sign in to comment.