]> git.lizzy.rs Git - rust.git/commitdiff
Don't dump diagnostics json if not absolutely necessary
authorOliver Scherer <github35764891676564198441@oli-obk.de>
Tue, 12 Mar 2019 19:38:31 +0000 (20:38 +0100)
committerOliver Scherer <github35764891676564198441@oli-obk.de>
Tue, 2 Apr 2019 14:14:58 +0000 (16:14 +0200)
src/tools/compiletest/src/json.rs
src/tools/compiletest/src/runtest.rs

index 15d449260efa0b445ac123ae28632db5ff5d3560..a14b50aa5877c5765df8307fa06fc7fc061285cc 100644 (file)
@@ -62,7 +62,7 @@ struct DiagnosticCode {
     explanation: Option<String>,
 }
 
-pub fn extract_rendered(output: &str, proc_res: &ProcRes) -> String {
+pub fn extract_rendered(output: &str) -> String {
     output
         .lines()
         .filter_map(|line| {
@@ -70,11 +70,12 @@ pub fn extract_rendered(output: &str, proc_res: &ProcRes) -> String {
                 match serde_json::from_str::<Diagnostic>(line) {
                     Ok(diagnostic) => diagnostic.rendered,
                     Err(error) => {
-                        proc_res.fatal(Some(&format!(
+                        print!(
                             "failed to decode compiler output as json: \
                              `{}`\nline: {}\noutput: {}",
                             error, line, output
-                        )));
+                        );
+                        panic!()
                     }
                 }
             } else {
index 9f57e79bb4c73871ed98595c4e823a97186d7204..b1b918803af5028cbb4bf8c65429e48c8f9f40fe 100644 (file)
@@ -2760,7 +2760,7 @@ fn run_ui_test(&self) {
         let stderr = if explicit {
             proc_res.stderr.clone()
         } else {
-            json::extract_rendered(&proc_res.stderr, &proc_res)
+            json::extract_rendered(&proc_res.stderr)
         };
 
         let normalized_stderr = self.normalize_output(&stderr, &self.props.normalize_stderr);
@@ -3377,7 +3377,9 @@ pub fn fatal(&self, err: Option<&str>) -> ! {
              {}\n\
              ------------------------------------------\n\
              \n",
-            self.status, self.cmdline, self.stdout, self.stderr
+            self.status, self.cmdline,
+            json::extract_rendered(&self.stdout),
+            json::extract_rendered(&self.stderr),
         );
         panic!();
     }