Skip to content

Commit 22befab

Browse files
committed
Avoid hard-coding rustc path in prepare.rs
1 parent b1d8b71 commit 22befab

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

build_system/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ pub(crate) fn main() {
149149
}
150150

151151
if command == Command::Prepare {
152-
prepare::prepare(&dirs);
152+
prepare::prepare(&dirs, &bootstrap_host_compiler.rustc);
153153
process::exit(0);
154154
}
155155

build_system/prepare.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ use super::rustc_info::{get_default_sysroot, get_rustc_version};
99
use super::tests::LIBCORE_TESTS_SRC;
1010
use super::utils::{copy_dir_recursively, git_command, retry_spawn_and_wait, spawn_and_wait};
1111

12-
pub(crate) fn prepare(dirs: &Dirs) {
12+
pub(crate) fn prepare(dirs: &Dirs, rustc: &Path) {
1313
RelPath::DOWNLOAD.ensure_fresh(dirs);
1414

15-
prepare_stdlib(dirs);
16-
prepare_coretests(dirs);
15+
prepare_stdlib(dirs, rustc);
16+
prepare_coretests(dirs, rustc);
1717

1818
super::tests::RAND_REPO.fetch(dirs);
1919
super::tests::REGEX_REPO.fetch(dirs);
2020
super::tests::PORTABLE_SIMD_REPO.fetch(dirs);
2121
}
2222

23-
fn prepare_stdlib(dirs: &Dirs) {
24-
let sysroot_src_orig = get_default_sysroot(Path::new("rustc")).join("lib/rustlib/src/rust");
23+
fn prepare_stdlib(dirs: &Dirs, rustc: &Path) {
24+
let sysroot_src_orig = get_default_sysroot(rustc).join("lib/rustlib/src/rust");
2525
assert!(sysroot_src_orig.exists());
2626

2727
eprintln!("[COPY] stdlib src");
@@ -36,7 +36,7 @@ fn prepare_stdlib(dirs: &Dirs) {
3636
&SYSROOT_SRC.to_path(dirs).join("library"),
3737
);
3838

39-
let rustc_version = get_rustc_version(Path::new("rustc"));
39+
let rustc_version = get_rustc_version(rustc);
4040
fs::write(SYSROOT_RUSTC_VERSION.to_path(dirs), &rustc_version).unwrap();
4141

4242
eprintln!("[GIT] init");
@@ -45,8 +45,8 @@ fn prepare_stdlib(dirs: &Dirs) {
4545
apply_patches(dirs, "stdlib", &SYSROOT_SRC.to_path(dirs));
4646
}
4747

48-
fn prepare_coretests(dirs: &Dirs) {
49-
let sysroot_src_orig = get_default_sysroot(Path::new("rustc")).join("lib/rustlib/src/rust");
48+
fn prepare_coretests(dirs: &Dirs, rustc: &Path) {
49+
let sysroot_src_orig = get_default_sysroot(rustc).join("lib/rustlib/src/rust");
5050
assert!(sysroot_src_orig.exists());
5151

5252
eprintln!("[COPY] coretests src");

0 commit comments

Comments
 (0)