diff --git a/build_system/mod.rs b/build_system/mod.rs index 2f8550dbf0e..58b21f64d37 100644 --- a/build_system/mod.rs +++ b/build_system/mod.rs @@ -149,7 +149,7 @@ pub(crate) fn main() { } if command == Command::Prepare { - prepare::prepare(&dirs); + prepare::prepare(&dirs, &bootstrap_host_compiler.rustc); process::exit(0); } diff --git a/build_system/prepare.rs b/build_system/prepare.rs index 2754b167850..ac2dc47dd7f 100644 --- a/build_system/prepare.rs +++ b/build_system/prepare.rs @@ -9,19 +9,19 @@ use super::tests::LIBCORE_TESTS_SRC; use super::utils::{copy_dir_recursively, git_command, retry_spawn_and_wait, spawn_and_wait}; -pub(crate) fn prepare(dirs: &Dirs) { +pub(crate) fn prepare(dirs: &Dirs, rustc: &Path) { RelPath::DOWNLOAD.ensure_fresh(dirs); - prepare_stdlib(dirs); - prepare_coretests(dirs); + prepare_stdlib(dirs, rustc); + prepare_coretests(dirs, rustc); super::tests::RAND_REPO.fetch(dirs); super::tests::REGEX_REPO.fetch(dirs); super::tests::PORTABLE_SIMD_REPO.fetch(dirs); } -fn prepare_stdlib(dirs: &Dirs) { - let sysroot_src_orig = get_default_sysroot(Path::new("rustc")).join("lib/rustlib/src/rust"); +fn prepare_stdlib(dirs: &Dirs, rustc: &Path) { + let sysroot_src_orig = get_default_sysroot(rustc).join("lib/rustlib/src/rust"); assert!(sysroot_src_orig.exists()); eprintln!("[COPY] stdlib src"); @@ -36,7 +36,7 @@ fn prepare_stdlib(dirs: &Dirs) { &SYSROOT_SRC.to_path(dirs).join("library"), ); - let rustc_version = get_rustc_version(Path::new("rustc")); + let rustc_version = get_rustc_version(rustc); fs::write(SYSROOT_RUSTC_VERSION.to_path(dirs), &rustc_version).unwrap(); eprintln!("[GIT] init"); @@ -45,8 +45,8 @@ fn prepare_stdlib(dirs: &Dirs) { apply_patches(dirs, "stdlib", &SYSROOT_SRC.to_path(dirs)); } -fn prepare_coretests(dirs: &Dirs) { - let sysroot_src_orig = get_default_sysroot(Path::new("rustc")).join("lib/rustlib/src/rust"); +fn prepare_coretests(dirs: &Dirs, rustc: &Path) { + let sysroot_src_orig = get_default_sysroot(rustc).join("lib/rustlib/src/rust"); assert!(sysroot_src_orig.exists()); eprintln!("[COPY] coretests src");