@@ -4,8 +4,6 @@ use std::fs;
4
4
use std:: path:: PathBuf ;
5
5
use std:: process:: { exit, Command } ;
6
6
7
- use build_helper:: t;
8
-
9
7
use crate :: builder:: { Builder , Cargo as CargoCommand , RunConfig , ShouldRun , Step } ;
10
8
use crate :: channel:: GitInfo ;
11
9
use crate :: compile;
@@ -214,10 +212,17 @@ impl Step for ToolBuild {
214
212
if tool == "tidy" {
215
213
tool = "rust-tidy" ;
216
214
}
217
- let cargo_out =
218
- builder. cargo_out ( compiler, self . mode , target) . join ( exe ( tool , compiler . host ) ) ;
219
- let bin = builder. tools_dir ( compiler) . join ( exe ( tool , compiler . host ) ) ;
215
+ let exe = exe ( tool , compiler . host ) ;
216
+ let cargo_out = builder. cargo_out ( compiler, self . mode , target) . join ( & exe) ;
217
+ let bin = builder. tools_dir ( compiler) . join ( & exe) ;
220
218
builder. copy ( & cargo_out, & bin) ;
219
+
220
+ // Don't create a stage0-sysroot/bin directory.
221
+ if compiler. stage > 0 {
222
+ let sysroot_bin = builder. sysroot_bindir ( compiler) . join ( & exe) ;
223
+ builder. copy ( & cargo_out, & sysroot_bin) ;
224
+ }
225
+
221
226
Some ( bin)
222
227
}
223
228
}
@@ -565,11 +570,9 @@ impl Step for Rustdoc {
565
570
. cargo_out ( build_compiler, Mode :: ToolRustc , target)
566
571
. join ( exe ( "rustdoc_tool_binary" , target_compiler. host ) ) ;
567
572
568
- // don 't create a stage0-sysroot/bin directory.
573
+ // Don 't create a stage0-sysroot/bin directory.
569
574
if target_compiler. stage > 0 {
570
- let sysroot = builder. sysroot ( target_compiler) ;
571
- let bindir = sysroot. join ( "bin" ) ;
572
- t ! ( fs:: create_dir_all( & bindir) ) ;
575
+ let bindir = builder. sysroot_bindir ( target_compiler) ;
573
576
let bin_rustdoc = bindir. join ( exe ( "rustdoc" , target_compiler. host ) ) ;
574
577
let _ = fs:: remove_file ( & bin_rustdoc) ;
575
578
builder. copy ( & tool_rustdoc, & bin_rustdoc) ;
0 commit comments