Skip to content

Commit 1380549

Browse files
authored
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
2 parents 89a7282 + 1665b80 commit 1380549

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/tools/compiletest/src/runtest/run_make.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,8 @@ impl TestCx<'_> {
353353
// to work correctly.
354354
//
355355
// See <https://github.com/rust-lang/rust/pull/122248> for more background.
356+
let stage0_sysroot = build_root.join("stage0-sysroot");
356357
if std::env::var_os("COMPILETEST_FORCE_STAGE0").is_some() {
357-
let stage0_sysroot = build_root.join("stage0-sysroot");
358358
rustc.arg("--sysroot").arg(&stage0_sysroot);
359359
}
360360

@@ -373,6 +373,15 @@ impl TestCx<'_> {
373373
// Compute dynamic library search paths for recipes.
374374
let recipe_dylib_search_paths = {
375375
let mut paths = base_dylib_search_paths.clone();
376+
377+
// For stage 0, we need to explicitly include the stage0-sysroot libstd dylib.
378+
// See <https://github.com/rust-lang/rust/issues/135373>.
379+
if std::env::var_os("COMPILETEST_FORCE_STAGE0").is_some() {
380+
paths.push(
381+
stage0_sysroot.join("lib").join("rustlib").join(&self.config.host).join("lib"),
382+
);
383+
}
384+
376385
paths.push(support_lib_path.parent().unwrap().to_path_buf());
377386
paths.push(stage_std_path.join("rustlib").join(&self.config.host).join("lib"));
378387
paths

src/tools/run-make-support/src/external_deps/rustdoc.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ impl Rustdoc {
4545
#[track_caller]
4646
pub fn new() -> Self {
4747
let mut cmd = setup_common();
48-
let target_rpath_dir = env_var_os("TARGET_RPATH_DIR");
49-
cmd.arg(format!("-L{}", target_rpath_dir.to_string_lossy()));
48+
cmd.arg("-L").arg(env_var_os("TARGET_RPATH_DIR"));
5049
Self { cmd }
5150
}
5251

0 commit comments

Comments
 (0)