Skip to content

Commit 3cca7ce

Browse files
committed
compiletest/rmake: better explain why stage0 sysroot is needed if forced stage0
1 parent 3b0dcbe commit 3cca7ce

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

src/tools/compiletest/src/runtest.rs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3638,12 +3638,29 @@ impl<'test> TestCx<'test> {
36383638
// annotated with `#[must_use]`.
36393639
rustc.arg("-Dunused_must_use");
36403640

3641-
// FIXME(jieyouxu): explain this!
3641+
// > `cg_clif` uses `COMPILETEST_FORCE_STAGE0=1 ./x.py test --stage 0` for running the rustc
3642+
// > test suite. With the introduction of rmake.rs this broke. `librun_make_support.rlib` is
3643+
// > compiled using the bootstrap rustc wrapper which sets `--sysroot
3644+
// > build/aarch64-unknown-linux-gnu/stage0-sysroot`, but then compiletest will compile
3645+
// > `rmake.rs` using the sysroot of the bootstrap compiler causing it to not find the
3646+
// > `libstd.rlib` against which `librun_make_support.rlib` is compiled.
3647+
//
3648+
// The gist here is that we have to pass the proper stage0 sysroot if we want
3649+
//
3650+
// ```
3651+
// $ COMPILETEST_FORCE_STAGE0=1 ./x test run-make --stage 0
3652+
// ```
3653+
//
3654+
// to work correctly.
3655+
//
3656+
// See <https://github.com/rust-lang/rust/pull/122248> for more background.
36423657
if std::env::var_os("COMPILETEST_FORCE_STAGE0").is_some() {
3643-
let mut stage0_sysroot = build_root.clone();
3644-
stage0_sysroot.push("stage0-sysroot");
3658+
let stage0_sysroot = {
3659+
let mut p = build_root.clone();
3660+
p.push("stage0-sysroot");
3661+
p
3662+
};
36453663
debug!(?stage0_sysroot);
3646-
debug!(exists = stage0_sysroot.exists());
36473664

36483665
rustc.arg("--sysroot").arg(&stage0_sysroot);
36493666
}

0 commit comments

Comments
 (0)