Skip to content

Commit

Permalink
Fix unexpected panic with the -Z treat-err-as-bug option
Browse files Browse the repository at this point in the history
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 rust-lang#35886.
  • Loading branch information
tommyip committed May 12, 2017
1 parent e19ccb7 commit 7a03b4c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/librustc_errors/diagnostic_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7a03b4c

Please sign in to comment.