Skip to content

Commit ea476b1

Browse files
committed
on the fly type casting for build.rustc and build.cargo
Signed-off-by: onur-ozkan <work@onurozkan.dev>
1 parent 21033f6 commit ea476b1

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/bootstrap/src/core/config/config.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -811,8 +811,8 @@ define_config! {
811811
host: Option<Vec<String>> = "host",
812812
target: Option<Vec<String>> = "target",
813813
build_dir: Option<String> = "build-dir",
814-
cargo: Option<String> = "cargo",
815-
rustc: Option<String> = "rustc",
814+
cargo: Option<PathBuf> = "cargo",
815+
rustc: Option<PathBuf> = "rustc",
816816
rustfmt: Option<PathBuf> = "rustfmt",
817817
docs: Option<bool> = "docs",
818818
compiler_docs: Option<bool> = "compiler-docs",
@@ -1421,7 +1421,7 @@ impl Config {
14211421
if !flags.skip_stage0_validation {
14221422
config.check_stage0_version(&rustc, "rustc");
14231423
}
1424-
PathBuf::from(rustc)
1424+
rustc
14251425
} else {
14261426
config.download_beta_toolchain();
14271427
config.out.join(config.build.triple).join("stage0/bin/rustc")
@@ -1431,7 +1431,7 @@ impl Config {
14311431
if !flags.skip_stage0_validation {
14321432
config.check_stage0_version(&cargo, "cargo");
14331433
}
1434-
PathBuf::from(cargo)
1434+
cargo
14351435
} else {
14361436
config.download_beta_toolchain();
14371437
config.out.join(config.build.triple).join("stage0/bin/cargo")
@@ -2292,7 +2292,7 @@ impl Config {
22922292
}
22932293

22942294
// check rustc/cargo version is same or lower with 1 apart from the building one
2295-
pub fn check_stage0_version(&self, program_path: &str, component_name: &'static str) {
2295+
pub fn check_stage0_version(&self, program_path: &Path, component_name: &'static str) {
22962296
if self.dry_run() {
22972297
return;
22982298
}
@@ -2303,7 +2303,8 @@ impl Config {
23032303
let stage0_name = stage0_output.next().unwrap();
23042304
if stage0_name != component_name {
23052305
fail(&format!(
2306-
"Expected to find {component_name} at {program_path} but it claims to be {stage0_name}"
2306+
"Expected to find {component_name} at {} but it claims to be {stage0_name}",
2307+
program_path.display()
23072308
));
23082309
}
23092310

0 commit comments

Comments
 (0)