about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2025-01-12 09:14:14 +0100
committerGitHub <noreply@github.com>2025-01-12 09:14:14 +0100
commit13805491b292e99aaee061e637a2c819d5892a10 (patch)
treeb07e1457a2e7be913272d8b9b03e0c5881a8e96a
parent89a728200001599bb5f7707869206a507a8c9194 (diff)
parent1665b80b715e66b7c191b9099ec76d2f55d3c2df (diff)
downloadrust-13805491b292e99aaee061e637a2c819d5892a10.tar.gz
rust-13805491b292e99aaee061e637a2c819d5892a10.zip
Rollup merge of #135389 - jieyouxu:fix-stage0-rustdoc-rmake, r=onur-ozkan
compiletest: include stage0-sysroot libstd dylib in recipe dylib search path

To fix some of the failures in `COMPILETEST_FORCE_STAGE0=1 ./x test run-make --stage 0`. Specifically,

```
COMPILETEST_FORCE_STAGE0=1 ./x test tests/run-make/rustdoc-default-output/ --stage 0
```

should now pass.

Fixes #135373. (As in, make *some* of the `run-make` tests pass, other `run-make` tests fail for various reasons against stage0, and generally `run-make` tests are not guaranteed to pass at stage 0.)

cc `@lolbinarycat`

r? bootstrap
-rw-r--r--src/tools/compiletest/src/runtest/run_make.rs11
-rw-r--r--src/tools/run-make-support/src/external_deps/rustdoc.rs3
2 files changed, 11 insertions, 3 deletions
diff --git a/src/tools/compiletest/src/runtest/run_make.rs b/src/tools/compiletest/src/runtest/run_make.rs
index ee7aed2a39c..8a49d630535 100644
--- a/src/tools/compiletest/src/runtest/run_make.rs
+++ b/src/tools/compiletest/src/runtest/run_make.rs
@@ -353,8 +353,8 @@ impl TestCx<'_> {
         // to work correctly.
         //
         // See <https://github.com/rust-lang/rust/pull/122248> for more background.
+        let stage0_sysroot = build_root.join("stage0-sysroot");
         if std::env::var_os("COMPILETEST_FORCE_STAGE0").is_some() {
-            let stage0_sysroot = build_root.join("stage0-sysroot");
             rustc.arg("--sysroot").arg(&stage0_sysroot);
         }
 
@@ -373,6 +373,15 @@ impl TestCx<'_> {
         // Compute dynamic library search paths for recipes.
         let recipe_dylib_search_paths = {
             let mut paths = base_dylib_search_paths.clone();
+
+            // For stage 0, we need to explicitly include the stage0-sysroot libstd dylib.
+            // See <https://github.com/rust-lang/rust/issues/135373>.
+            if std::env::var_os("COMPILETEST_FORCE_STAGE0").is_some() {
+                paths.push(
+                    stage0_sysroot.join("lib").join("rustlib").join(&self.config.host).join("lib"),
+                );
+            }
+
             paths.push(support_lib_path.parent().unwrap().to_path_buf());
             paths.push(stage_std_path.join("rustlib").join(&self.config.host).join("lib"));
             paths
diff --git a/src/tools/run-make-support/src/external_deps/rustdoc.rs b/src/tools/run-make-support/src/external_deps/rustdoc.rs
index df5e5d8a2e8..3c0e9c82f0b 100644
--- a/src/tools/run-make-support/src/external_deps/rustdoc.rs
+++ b/src/tools/run-make-support/src/external_deps/rustdoc.rs
@@ -45,8 +45,7 @@ impl Rustdoc {
     #[track_caller]
     pub fn new() -> Self {
         let mut cmd = setup_common();
-        let target_rpath_dir = env_var_os("TARGET_RPATH_DIR");
-        cmd.arg(format!("-L{}", target_rpath_dir.to_string_lossy()));
+        cmd.arg("-L").arg(env_var_os("TARGET_RPATH_DIR"));
         Self { cmd }
     }