about summary refs log tree commit diff
path: root/src/librustc_errors/diagnostic_builder.rs
diff options
context:
space:
mode:
authorMark Simulacrum <mark.simulacrum@gmail.com>2017-05-12 18:57:37 -0600
committerGitHub <noreply@github.com>2017-05-12 18:57:37 -0600
commitc17811cce3203c4b5a12aad93f190aaf9fdf7fc2 (patch)
tree6d457b0de0423f25e182442a551d8f0e7dc0018f /src/librustc_errors/diagnostic_builder.rs
parent6e29059c3ecb26d97ba2a34ff68081c11cc3d270 (diff)
parent7a03b4c75ad985812467742faa8d76a14a4bf601 (diff)
downloadrust-c17811cce3203c4b5a12aad93f190aaf9fdf7fc2.tar.gz
rust-c17811cce3203c4b5a12aad93f190aaf9fdf7fc2.zip
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
Diffstat (limited to 'src/librustc_errors/diagnostic_builder.rs')
-rw-r--r--src/librustc_errors/diagnostic_builder.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/librustc_errors/diagnostic_builder.rs b/src/librustc_errors/diagnostic_builder.rs
index d03a4acb9fc..fc5fd44f091 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);