diff options
| author | Tommy Ip <hkmp7tommy@gmail.com> | 2017-05-12 12:48:18 +0100 |
|---|---|---|
| committer | Tommy Ip <hkmp7tommy@gmail.com> | 2017-05-12 12:54:20 +0100 |
| commit | 7a03b4c75ad985812467742faa8d76a14a4bf601 (patch) | |
| tree | c90911b950e7ceb01f00aba149974a9057c11453 /src/librustc_errors | |
| parent | e19ccb71c8427135a69d874623af68422aeeb9e9 (diff) | |
| download | rust-7a03b4c75ad985812467742faa8d76a14a4bf601.tar.gz rust-7a03b4c75ad985812467742faa8d76a14a4bf601.zip | |
Fix unexpected panic with the -Z treat-err-as-bug option
This fix an issue where the compiler panics even if there is no error when passed with the `-Z treat-err-as-bug` option. Fixes #35886.
Diffstat (limited to 'src/librustc_errors')
| -rw-r--r-- | src/librustc_errors/diagnostic_builder.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/librustc_errors/diagnostic_builder.rs b/src/librustc_errors/diagnostic_builder.rs index a9c2bbeba2a..84fb4b19275 100644 --- a/src/librustc_errors/diagnostic_builder.rs +++ b/src/librustc_errors/diagnostic_builder.rs @@ -99,7 +99,10 @@ impl<'a> DiagnosticBuilder<'a> { self.handler.emitter.borrow_mut().emit(&self); self.cancel(); - self.handler.panic_if_treat_err_as_bug(); + + if self.level == Level::Error { + self.handler.panic_if_treat_err_as_bug(); + } // if self.is_fatal() { // panic!(FatalError); |
