File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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`.
You can’t perform that action at this time.
0 commit comments