Skip to content

Commit cdea21d

Browse files
committed
compiletest/rmake: better explain why stage0 sysroot is needed if forced stage0
1 parent b0168d9 commit cdea21d

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
@@ -3633,12 +3633,29 @@ impl<'test> TestCx<'test> {
36333633
// annotated with `#[must_use]`.
36343634
rustc.arg("-Dunused_must_use");
36353635

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

36433660
rustc.arg("--sysroot").arg(&stage0_sysroot);
36443661
}

0 commit comments

Comments
 (0)