Skip to content

Commit 0f8b3fe

Browse files
committed
compiletest/rmake: better explain why stage0 sysroot is needed if forced stage0
1 parent 0390331 commit 0f8b3fe

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

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

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

0 commit comments

Comments
 (0)