Rollup merge of #41942 - tommyip:master, r=Mark-Simulacrum

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.

r? @Mark-Simulacrum
This commit is contained in:
Mark Simulacrum 2017-05-12 18:57:37 -06:00 committed by GitHub
commit c17811cce3
1 changed files with 4 additions and 1 deletions

View File

@ -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);