Skip to content

Commit bfa5e5f

Browse files
committed
Fallback to the unmodified path in bindir_relative
1 parent 1aee3e4 commit bfa5e5f

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/bootstrap/builder.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1232,8 +1232,7 @@ impl<'a> Builder<'a> {
12321232
}
12331233

12341234
// Try to use a sysroot-relative bindir, in case it was configured absolutely.
1235-
let bindir = self.config.bindir_relative().unwrap_or(&self.config.bindir);
1236-
cargo.env("RUSTC_INSTALL_BINDIR", bindir);
1235+
cargo.env("RUSTC_INSTALL_BINDIR", self.config.bindir_relative());
12371236

12381237
self.ci_env.force_coloring_in_ci(&mut cargo);
12391238

src/bootstrap/config.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -647,15 +647,18 @@ impl Config {
647647
config
648648
}
649649

650-
/// Try to find the relative path of `bindir`.
651-
pub fn bindir_relative(&self) -> Option<&Path> {
650+
/// Try to find the relative path of `bindir`, otherwise return it in full.
651+
pub fn bindir_relative(&self) -> &Path {
652652
let bindir = &self.bindir;
653-
if bindir.is_relative() {
654-
Some(bindir)
655-
} else {
653+
if bindir.is_absolute() {
656654
// Try to make it relative to the prefix.
657-
bindir.strip_prefix(self.prefix.as_ref()?).ok()
655+
if let Some(prefix) = &self.prefix {
656+
if let Ok(stripped) = bindir.strip_prefix(prefix) {
657+
return stripped;
658+
}
659+
}
658660
}
661+
bindir
659662
}
660663

661664
/// Try to find the relative path of `libdir`.

0 commit comments

Comments
 (0)