about summary refs log tree commit diff
path: root/src/librustdoc/doctest.rs
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2025-09-25 16:42:45 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2025-09-25 16:42:45 +0200
commit9877b26fd14d32064b1f944dd1e79c9c8faccf16 (patch)
treecb38c43dfddd8fdb588021a17c55378c81ccfa6f /src/librustdoc/doctest.rs
parentbbcbc7818ba27c951f9fd881fd3ec4cd5123b741 (diff)
downloadrust-9877b26fd14d32064b1f944dd1e79c9c8faccf16.tar.gz
rust-9877b26fd14d32064b1f944dd1e79c9c8faccf16.zip
Correctly display merged doctest compilation time
Diffstat (limited to 'src/librustdoc/doctest.rs')
-rw-r--r--src/librustdoc/doctest.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs
index 95bd31729de..9499258f983 100644
--- a/src/librustdoc/doctest.rs
+++ b/src/librustdoc/doctest.rs
@@ -404,11 +404,15 @@ pub(crate) fn run_tests(
             std::mem::drop(temp_dir.take());
             times.display_times();
         });
+    } else {
+        // If the first condition branch exited successfully, `test_main_with_exit_callback` will
+        // not exit the process. So to prevent displaying the times twice, we put it behind an
+        // `else` condition.
+        times.display_times();
     }
+    // We ensure temp dir destructor is called.
+    std::mem::drop(temp_dir);
     if nb_errors != 0 {
-        // We ensure temp dir destructor is called.
-        std::mem::drop(temp_dir);
-        times.display_times();
         std::process::exit(test::ERROR_EXIT_CODE);
     }
 }