@@ -1161,14 +1161,7 @@ impl<'a> Builder<'a> {
11611161        self . ensure ( compile:: Sysroot :: new ( compiler) ) 
11621162    } 
11631163
1164-     /// Returns the bindir for a compiler's sysroot. 
1165-      pub  fn  sysroot_target_bindir ( & self ,  compiler :  Compiler ,  target :  TargetSelection )  -> PathBuf  { 
1166-         self . sysroot_target_libdir ( compiler,  target) . parent ( ) . unwrap ( ) . join ( "bin" ) 
1167-     } 
1168- 
1169-     /// Returns the libdir where the standard library and other artifacts are 
1170-      /// found for a compiler's sysroot. 
1171-      pub  fn  sysroot_target_libdir ( & self ,  compiler :  Compiler ,  target :  TargetSelection )  -> PathBuf  { 
1164+     fn  ensure_sysroot_target_dir ( & self ,  compiler :  Compiler ,  target :  TargetSelection )  -> PathBuf  { 
11721165        #[ derive( Debug ,  Clone ,  Hash ,  PartialEq ,  Eq ) ]  
11731166        struct  Libdir  { 
11741167            compiler :  Compiler , 
@@ -1183,25 +1176,26 @@ impl<'a> Builder<'a> {
11831176
11841177            fn  run ( self ,  builder :  & Builder < ' _ > )  -> PathBuf  { 
11851178                let  lib = builder. sysroot_libdir_relative ( self . compiler ) ; 
1186-                 let  sysroot = builder
1187-                     . sysroot ( self . compiler ) 
1188-                     . join ( lib) 
1189-                     . join ( "rustlib" ) 
1190-                     . join ( self . target ) 
1191-                     . join ( "lib" ) ; 
1192-                 // Avoid deleting the rustlib/ directory we just copied 
1193-                 // (in `impl Step for Sysroot`). 
1179+                 let  sysroot = builder. sysroot ( self . compiler ) . join ( lib) . join ( "rustlib" ) ; 
1180+ 
1181+                 // Avoid deleting the `rustlib/` directory we just copied (in `impl Step for 
1182+                 // Sysroot`). 
11941183                if  !builder. download_rustc ( )  { 
1184+                     let  sysroot_target_libdir = sysroot. join ( self . target ) . join ( "lib" ) ; 
11951185                    builder. verbose ( || { 
1196-                         println ! ( "Removing sysroot {} to avoid caching bugs" ,  sysroot. display( ) ) 
1186+                         println ! ( 
1187+                             "Removing sysroot {} to avoid caching bugs" , 
1188+                             sysroot_target_libdir. display( ) 
1189+                         ) 
11971190                    } ) ; 
1198-                     let  _ = fs:: remove_dir_all ( & sysroot ) ; 
1199-                     t ! ( fs:: create_dir_all( & sysroot ) ) ; 
1191+                     let  _ = fs:: remove_dir_all ( & sysroot_target_libdir ) ; 
1192+                     t ! ( fs:: create_dir_all( & sysroot_target_libdir ) ) ; 
12001193                } 
12011194
12021195                if  self . compiler . stage  == 0  { 
1203-                     // The stage 0 compiler for the build triple is always pre-built. 
1204-                     // Ensure that `libLLVM.so` ends up in the target libdir, so that ui-fulldeps tests can use it when run. 
1196+                     // The stage 0 compiler for the build triple is always pre-built. Ensure that 
1197+                     // `libLLVM.so` ends up in the target libdir, so that ui-fulldeps tests can use 
1198+                     // it when run. 
12051199                    dist:: maybe_install_llvm_target ( 
12061200                        builder, 
12071201                        self . compiler . host , 
@@ -1212,9 +1206,21 @@ impl<'a> Builder<'a> {
12121206                sysroot
12131207            } 
12141208        } 
1209+ 
12151210        self . ensure ( Libdir  {  compiler,  target } ) 
12161211    } 
12171212
1213+     /// Returns the bindir for a compiler's sysroot. 
1214+      pub  fn  sysroot_target_bindir ( & self ,  compiler :  Compiler ,  target :  TargetSelection )  -> PathBuf  { 
1215+         self . ensure_sysroot_target_dir ( compiler,  target) . join ( target) . join ( "bin" ) 
1216+     } 
1217+ 
1218+     /// Returns the libdir where the standard library and other artifacts are 
1219+      /// found for a compiler's sysroot. 
1220+      pub  fn  sysroot_target_libdir ( & self ,  compiler :  Compiler ,  target :  TargetSelection )  -> PathBuf  { 
1221+         self . ensure_sysroot_target_dir ( compiler,  target) . join ( target) . join ( "lib" ) 
1222+     } 
1223+ 
12181224    pub  fn  sysroot_codegen_backends ( & self ,  compiler :  Compiler )  -> PathBuf  { 
12191225        self . sysroot_target_libdir ( compiler,  compiler. host ) . with_file_name ( "codegen-backends" ) 
12201226    } 
0 commit comments