From 934e7e6c26cc9c78a176a48c3e7d2b9fff501dd8 Mon Sep 17 00:00:00 2001 From: jyn Date: Wed, 5 Jul 2023 11:38:55 -0500 Subject: [PATCH] Move `ci_rustc_dir` to Config and use it consistently --- src/bootstrap/compile.rs | 4 ++-- src/bootstrap/config.rs | 6 ++++++ src/bootstrap/download.rs | 2 +- src/bootstrap/lib.rs | 5 ----- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 14c3ef79a78..53197212b2e 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -645,8 +645,8 @@ fn cp_rustc_component_to_ci_sysroot( contents: Vec, ) { let sysroot = builder.ensure(Sysroot { compiler, force_recompile: false }); + let ci_rustc_dir = builder.config.ci_rustc_dir(); - let ci_rustc_dir = builder.out.join(&*builder.build.build.triple).join("ci-rustc"); for file in contents { let src = ci_rustc_dir.join(&file); let dst = sysroot.join(file); @@ -1381,7 +1381,7 @@ impl Step for Sysroot { // FIXME: this is wrong when compiler.host != build, but we don't support that today OsStr::new(std::env::consts::DLL_EXTENSION), ]; - let ci_rustc_dir = builder.ci_rustc_dir(builder.config.build); + let ci_rustc_dir = builder.config.ci_rustc_dir(); builder.cp_filtered(&ci_rustc_dir, &sysroot, &|path| { if path.extension().map_or(true, |ext| !filtered_extensions.contains(&ext)) { return true; diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index af29fe0baae..bf4bf4f938c 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -1800,6 +1800,12 @@ impl Config { self.out.join(&*self.build.triple).join("ci-llvm") } + /// Directory where the extracted `rustc-dev` component is stored. + pub(crate) fn ci_rustc_dir(&self) -> PathBuf { + assert!(self.download_rustc()); + self.out.join(self.build.triple).join("ci-rustc") + } + /// Determine whether llvm should be linked dynamically. /// /// If `false`, llvm should be linked statically. diff --git a/src/bootstrap/download.rs b/src/bootstrap/download.rs index 90578065ba2..a081f6189d7 100644 --- a/src/bootstrap/download.rs +++ b/src/bootstrap/download.rs @@ -406,7 +406,7 @@ impl Config { return vec![]; } - let ci_rustc_dir = self.out.join(&*self.build.triple).join("ci-rustc"); + let ci_rustc_dir = self.ci_rustc_dir(); let stamp_file = ci_rustc_dir.join(stamp_file); let contents_file = t!(File::open(&stamp_file), stamp_file.display().to_string()); t!(BufReader::new(contents_file).lines().collect()) diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 6a51450a777..0dded6d011f 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -819,11 +819,6 @@ impl Build { self.stage_out(compiler, mode).join(&*target.triple).join(self.cargo_dir()) } - /// Directory where the extracted `rustc-dev` component is stored. - fn ci_rustc_dir(&self, target: TargetSelection) -> PathBuf { - self.out.join(&*target.triple).join("ci-rustc") - } - /// Root output directory for LLVM compiled for `target` /// /// Note that if LLVM is configured externally then the directory returned