about summary refs log tree commit diff
path: root/src/tools
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-02-04 14:58:59 +0100
committerGitHub <noreply@github.com>2022-02-04 14:58:59 +0100
commitc77f0a42d3de096aa0ebac4aa73449864f3afdfb (patch)
treec523587b4bb2f44d738cd88ba67edf05fce9f717 /src/tools
parentf7e0f9763128603d2249d3cb1c41a23f261d6e1e (diff)
parent71249a9ef7a47226bbfc6d652bfb731124822c68 (diff)
downloadrust-c77f0a42d3de096aa0ebac4aa73449864f3afdfb.tar.gz
rust-c77f0a42d3de096aa0ebac4aa73449864f3afdfb.zip
Rollup merge of #93508 - CraftSpider:jsondocck-runtest-output, r=Mark-Simulacrum
Add rustdoc info to jsondocck output

Makes debugging issues in the generated output simpler by handling emitted logs and etc.
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/compiletest/src/runtest.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 00221b07f74..f6ddac3a65e 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -2424,7 +2424,10 @@ impl<'test> TestCx<'test> {
         );
 
         if !res.status.success() {
-            self.fatal_proc_rec("jsondocck failed!", &res)
+            self.fatal_proc_rec_with_ctx("jsondocck failed!", &res, |_| {
+                println!("Rustdoc Output:");
+                proc_res.print_info();
+            })
         }
 
         let mut json_out = out_dir.join(self.testpaths.file.file_stem().unwrap());
@@ -3738,10 +3741,7 @@ pub struct ProcRes {
 }
 
 impl ProcRes {
-    pub fn fatal(&self, err: Option<&str>, on_failure: impl FnOnce()) -> ! {
-        if let Some(e) = err {
-            println!("\nerror: {}", e);
-        }
+    pub fn print_info(&self) {
         print!(
             "\
              status: {}\n\
@@ -3760,6 +3760,13 @@ impl ProcRes {
             json::extract_rendered(&self.stdout),
             json::extract_rendered(&self.stderr),
         );
+    }
+
+    pub fn fatal(&self, err: Option<&str>, on_failure: impl FnOnce()) -> ! {
+        if let Some(e) = err {
+            println!("\nerror: {}", e);
+        }
+        self.print_info();
         on_failure();
         // Use resume_unwind instead of panic!() to prevent a panic message + backtrace from
         // compiletest, which is unnecessary noise.