diff options
| author | Seiichi Uchida <seuchida@gmail.com> | 2017-08-10 09:17:03 +0900 |
|---|---|---|
| committer | topecongiro <seuchida@gmail.com> | 2017-08-23 21:56:09 +0900 |
| commit | 601e3dac6cd71bf657c04fceb868540031e6db95 (patch) | |
| tree | add1e3dcb076898b36e486844df0665ead61a6cc | |
| parent | f142499539d038ef60f4e22cafe11ecdd8a29a1d (diff) | |
| download | rust-601e3dac6cd71bf657c04fceb868540031e6db95.tar.gz rust-601e3dac6cd71bf657c04fceb868540031e6db95.zip | |
Add reset_err_count() to errors::Handler
The motivation here is to allow rustfmt to recover from parse errors after failing to parse macros.
| -rw-r--r-- | src/librustc_errors/lib.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index 159d2c7a2df..62b1944e9cb 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -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, "") } |
