about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2025-07-31 13:12:46 +0200
committerGitHub <noreply@github.com>2025-07-31 13:12:46 +0200
commitfebd8cdd4457f8ff67b7dd510ae99392f108af1a (patch)
tree6e183eb6f6334261554c18489b481ff08b28cd59
parent1d5baad62b71009cb235cc6786673747c2a5efbd (diff)
parentbee5fbf36e9cbb7f3317ce6a71b3574dc007dee5 (diff)
downloadrust-febd8cdd4457f8ff67b7dd510ae99392f108af1a.tar.gz
rust-febd8cdd4457f8ff67b7dd510ae99392f108af1a.zip
Rollup merge of #144297 - GuillaumeGomez:ERROR_EXIT_CODE, r=Amanieu
Make `libtest::ERROR_EXIT_CODE` const public to not redefine it in rustdoc

I think it's better to make this constant public so it can be used by crates using `libtest` as dependency.

As a side-note, I will update https://github.com/rust-lang/rust/pull/143900 to make use of this constant once this is current PR is merged.
-rw-r--r--library/test/src/lib.rs4
-rw-r--r--src/librustdoc/doctest.rs3
2 files changed, 4 insertions, 3 deletions
diff --git a/library/test/src/lib.rs b/library/test/src/lib.rs
index 7f56d1e3626..1190bb56b97 100644
--- a/library/test/src/lib.rs
+++ b/library/test/src/lib.rs
@@ -89,8 +89,8 @@ use options::RunStrategy;
 use test_result::*;
 use time::TestExecTime;
 
-// Process exit code to be used to indicate test failures.
-const ERROR_EXIT_CODE: i32 = 101;
+/// Process exit code to be used to indicate test failures.
+pub const ERROR_EXIT_CODE: i32 = 101;
 
 const SECONDARY_TEST_INVOKER_VAR: &str = "__RUST_TEST_INVOKE";
 const SECONDARY_TEST_BENCH_BENCHMARKS_VAR: &str = "__RUST_TEST_BENCH_BENCHMARKS";
diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs
index 0bef091468f..35ace656638 100644
--- a/src/librustdoc/doctest.rs
+++ b/src/librustdoc/doctest.rs
@@ -409,7 +409,8 @@ pub(crate) fn run_tests(
         // We ensure temp dir destructor is called.
         std::mem::drop(temp_dir);
         times.display_times();
-        // libtest::ERROR_EXIT_CODE is not public but it's the same value.
+        // FIXME(GuillaumeGomez): Uncomment the next line once #144297 has been merged.
+        // std::process::exit(test::ERROR_EXIT_CODE);
         std::process::exit(101);
     }
 }