about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJieyou Xu <jieyouxu@outlook.com>2025-06-30 15:03:17 +0800
committerJieyou Xu <jieyouxu@outlook.com>2025-06-30 15:03:17 +0800
commitc8cef5bfaa57d58ef87799281f1394286ab85b0a (patch)
treea0c20ad008a438804e7172a559d12f3b3604d9e0
parentf19142044f270760ce0ebc03b2c3a44217d8703d (diff)
downloadrust-c8cef5bfaa57d58ef87799281f1394286ab85b0a.tar.gz
rust-c8cef5bfaa57d58ef87799281f1394286ab85b0a.zip
Move some early config checks to the compiletest lib
-rw-r--r--src/tools/compiletest/src/lib.rs15
-rw-r--r--src/tools/compiletest/src/main.rs16
2 files changed, 17 insertions, 14 deletions
diff --git a/src/tools/compiletest/src/lib.rs b/src/tools/compiletest/src/lib.rs
index 0db4d3f6a41..c1a4839605c 100644
--- a/src/tools/compiletest/src/lib.rs
+++ b/src/tools/compiletest/src/lib.rs
@@ -1111,3 +1111,18 @@ fn check_for_overlapping_test_paths(found_path_stems: &HashSet<Utf8PathBuf>) {
         );
     }
 }
+
+pub fn early_config_check(config: &Config) {
+    if !config.has_html_tidy && config.mode == Mode::Rustdoc {
+        eprintln!("warning: `tidy` (html-tidy.org) is not installed; diffs will not be generated");
+    }
+
+    if !config.profiler_runtime && config.mode == Mode::CoverageRun {
+        let actioned = if config.bless { "blessed" } else { "checked" };
+        eprintln!(
+            r#"
+WARNING: profiler runtime is not available, so `.coverage` files won't be {actioned}
+help: try setting `profiler = true` in the `[build]` section of `bootstrap.toml`"#
+        );
+    }
+}
diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs
index b9ae583581e..1f777e71cf9 100644
--- a/src/tools/compiletest/src/main.rs
+++ b/src/tools/compiletest/src/main.rs
@@ -2,8 +2,7 @@ use std::env;
 use std::io::IsTerminal;
 use std::sync::Arc;
 
-use compiletest::common::Mode;
-use compiletest::{log_config, parse_config, run_tests};
+use compiletest::{early_config_check, log_config, parse_config, run_tests};
 
 fn main() {
     tracing_subscriber::fmt::init();
@@ -18,18 +17,7 @@ fn main() {
 
     let config = Arc::new(parse_config(env::args().collect()));
 
-    if !config.has_html_tidy && config.mode == Mode::Rustdoc {
-        eprintln!("warning: `tidy` (html-tidy.org) is not installed; diffs will not be generated");
-    }
-
-    if !config.profiler_runtime && config.mode == Mode::CoverageRun {
-        let actioned = if config.bless { "blessed" } else { "checked" };
-        eprintln!(
-            r#"
-WARNING: profiler runtime is not available, so `.coverage` files won't be {actioned}
-help: try setting `profiler = true` in the `[build]` section of `bootstrap.toml`"#
-        );
-    }
+    early_config_check(&config);
 
     log_config(&config);
     run_tests(config);