use ci-rustc-sysroot for sysroot when download_rustc

This commit is contained in:
yukang 2022-10-04 10:48:53 +08:00
parent 973ff033f3
commit 60b39ba9a5
2 changed files with 5 additions and 5 deletions

View File

@ -1102,6 +1102,8 @@ impl Step for Sysroot {
let host_dir = builder.out.join(&compiler.host.triple);
let sysroot = if compiler.stage == 0 {
host_dir.join("stage0-sysroot")
} else if builder.download_rustc() {
host_dir.join("ci-rustc-sysroot")
} else {
host_dir.join(format!("stage{}", compiler.stage))
};
@ -1115,7 +1117,7 @@ impl Step for Sysroot {
"Cross-compiling is not yet supported with `download-rustc`",
);
// #102002, cleanup stage1 and stage0-sysroot folders when using download-rustc
// #102002, cleanup stage1 and stage0-sysroot folders when using download-rustc so people don't use old versions of the toolchain by accident.
let _ = fs::remove_dir_all(host_dir.join("stage1"));
let _ = fs::remove_dir_all(host_dir.join("stage0-sysroot"));

View File

@ -512,10 +512,8 @@ impl Step for Rustdoc {
// Similar to `compile::Assemble`, build with the previous stage's compiler. Otherwise
// we'd have stageN/bin/rustc and stageN/bin/rustdoc be effectively different stage
// compilers, which isn't what we want. Rustdoc should be linked in the same way as the
// rustc compiler it's paired with, so it must be built with the previous stage compiler,
// if download_rustc is true, we will use the same target stage.
let target_stage = target_compiler.stage - if builder.download_rustc() { 0 } else { 1 };
let build_compiler = builder.compiler(target_stage, builder.config.build);
// rustc compiler it's paired with, so it must be built with the previous stage compiler.
let build_compiler = builder.compiler(target_compiler.stage - 1, builder.config.build);
// When using `download-rustc` and a stage0 build_compiler, copying rustc doesn't actually
// build stage0 libstd (because the libstd in sysroot has the wrong ABI). Explicitly build