@@ -41,7 +41,8 @@ pub enum ToolArtifactKind {
4141
4242#[ derive( Debug , Clone , Hash , PartialEq , Eq ) ]
4343struct ToolBuild {
44- compiler : Compiler ,
44+ /// Compiler that will build this tool.
45+ build_compiler : Compiler ,
4546 target : TargetSelection ,
4647 tool : & ' static str ,
4748 path : & ' static str ,
@@ -111,25 +112,25 @@ impl Step for ToolBuild {
111112 let mut tool = self . tool ;
112113 let path = self . path ;
113114
114- let target_compiler = self . compiler ;
115- self . compiler = if self . mode == Mode :: ToolRustc {
116- get_tool_rustc_compiler ( builder, self . compiler )
115+ let target_compiler = self . build_compiler ;
116+ self . build_compiler = if self . mode == Mode :: ToolRustc {
117+ get_tool_rustc_compiler ( builder, self . build_compiler )
117118 } else {
118- self . compiler
119+ self . build_compiler
119120 } ;
120121
121122 match self . mode {
122123 Mode :: ToolRustc => {
123124 // If compiler was forced, its artifacts should have been prepared earlier.
124- if !self . compiler . is_forced_compiler ( ) {
125- builder. std ( self . compiler , self . compiler . host ) ;
126- builder. ensure ( compile:: Rustc :: new ( self . compiler , target) ) ;
125+ if !self . build_compiler . is_forced_compiler ( ) {
126+ builder. std ( self . build_compiler , self . build_compiler . host ) ;
127+ builder. ensure ( compile:: Rustc :: new ( self . build_compiler , target) ) ;
127128 }
128129 }
129130 Mode :: ToolStd => {
130131 // If compiler was forced, its artifacts should have been prepared earlier.
131- if !self . compiler . is_forced_compiler ( ) {
132- builder. std ( self . compiler , target)
132+ if !self . build_compiler . is_forced_compiler ( ) {
133+ builder. std ( self . build_compiler , target) ;
133134 }
134135 }
135136 Mode :: ToolBootstrap => { } // uses downloaded stage0 compiler libs
@@ -151,7 +152,7 @@ impl Step for ToolBuild {
151152
152153 let mut cargo = prepare_tool_cargo (
153154 builder,
154- self . compiler ,
155+ self . build_compiler ,
155156 self . mode ,
156157 target,
157158 Kind :: Build ,
@@ -173,7 +174,7 @@ impl Step for ToolBuild {
173174
174175 // Rustc tools (miri, clippy, cargo, rustfmt, rust-analyzer)
175176 // could use the additional optimizations.
176- if self . mode == Mode :: ToolRustc && is_lto_stage ( & self . compiler ) {
177+ if self . mode == Mode :: ToolRustc && is_lto_stage ( & self . build_compiler ) {
177178 let lto = match builder. config . rust_lto {
178179 RustcLto :: Off => Some ( "off" ) ,
179180 RustcLto :: Thin => Some ( "thin" ) ,
@@ -195,8 +196,8 @@ impl Step for ToolBuild {
195196 Kind :: Build ,
196197 self . mode ,
197198 self . tool ,
198- self . compiler . stage ,
199- & self . compiler . host ,
199+ self . build_compiler . stage ,
200+ & self . build_compiler . host ,
200201 & self . target ,
201202 ) ;
202203
@@ -219,14 +220,14 @@ impl Step for ToolBuild {
219220 }
220221 let tool_path = match self . artifact_kind {
221222 ToolArtifactKind :: Binary => {
222- copy_link_tool_bin ( builder, self . compiler , self . target , self . mode , tool)
223+ copy_link_tool_bin ( builder, self . build_compiler , self . target , self . mode , tool)
223224 }
224225 ToolArtifactKind :: Library => builder
225- . cargo_out ( self . compiler , self . mode , self . target )
226+ . cargo_out ( self . build_compiler , self . mode , self . target )
226227 . join ( format ! ( "lib{tool}.rlib" ) ) ,
227228 } ;
228229
229- ToolBuildResult { tool_path, build_compiler : self . compiler , target_compiler }
230+ ToolBuildResult { tool_path, build_compiler : self . build_compiler , target_compiler }
230231 }
231232 }
232233}
@@ -450,7 +451,7 @@ macro_rules! bootstrap_tool {
450451 let compiletest_wants_stage0 = $tool_name == "compiletest" && builder. config. compiletest_use_stage0_libtest;
451452
452453 builder. ensure( ToolBuild {
453- compiler : self . compiler,
454+ build_compiler : self . compiler,
454455 target: self . target,
455456 tool: $tool_name,
456457 mode: if is_unstable && !compiletest_wants_stage0 {
@@ -560,7 +561,7 @@ impl Step for RustcPerf {
560561 builder. require_submodule ( "src/tools/rustc-perf" , None ) ;
561562
562563 let tool = ToolBuild {
563- compiler : self . compiler ,
564+ build_compiler : self . compiler ,
564565 target : self . target ,
565566 tool : "collector" ,
566567 mode : Mode :: ToolBootstrap ,
@@ -576,7 +577,7 @@ impl Step for RustcPerf {
576577 let res = builder. ensure ( tool. clone ( ) ) ;
577578 // We also need to symlink the `rustc-fake` binary to the corresponding directory,
578579 // because `collector` expects it in the same directory.
579- copy_link_tool_bin ( builder, tool. compiler , tool. target , tool. mode , "rustc-fake" ) ;
580+ copy_link_tool_bin ( builder, tool. build_compiler , tool. target , tool. mode , "rustc-fake" ) ;
580581
581582 res
582583 }
@@ -620,7 +621,7 @@ impl Step for ErrorIndex {
620621
621622 fn run ( self , builder : & Builder < ' _ > ) -> ToolBuildResult {
622623 builder. ensure ( ToolBuild {
623- compiler : self . compiler ,
624+ build_compiler : self . compiler ,
624625 target : self . compiler . host ,
625626 tool : "error_index_generator" ,
626627 mode : Mode :: ToolRustc ,
@@ -656,7 +657,7 @@ impl Step for RemoteTestServer {
656657
657658 fn run ( self , builder : & Builder < ' _ > ) -> ToolBuildResult {
658659 builder. ensure ( ToolBuild {
659- compiler : self . compiler ,
660+ build_compiler : self . compiler ,
660661 target : self . target ,
661662 tool : "remote-test-server" ,
662663 mode : Mode :: ToolStd ,
@@ -757,7 +758,7 @@ impl Step for Rustdoc {
757758
758759 let ToolBuildResult { tool_path, build_compiler, target_compiler } =
759760 builder. ensure ( ToolBuild {
760- compiler : target_compiler,
761+ build_compiler : target_compiler,
761762 target,
762763 // Cargo adds a number of paths to the dylib search path on windows, which results in
763764 // the wrong rustdoc being executed. To avoid the conflicting rustdocs, we name the "tool"
@@ -825,7 +826,7 @@ impl Step for Cargo {
825826 builder. build . require_submodule ( "src/tools/cargo" , None ) ;
826827
827828 builder. ensure ( ToolBuild {
828- compiler : self . compiler ,
829+ build_compiler : self . compiler ,
829830 target : self . target ,
830831 tool : "cargo" ,
831832 mode : Mode :: ToolRustc ,
@@ -873,7 +874,7 @@ impl Step for LldWrapper {
873874 let target = self . target_compiler . host ;
874875
875876 let tool_result = builder. ensure ( ToolBuild {
876- compiler : self . build_compiler ,
877+ build_compiler : self . build_compiler ,
877878 target,
878879 tool : "lld-wrapper" ,
879880 mode : Mode :: ToolStd ,
@@ -941,7 +942,7 @@ impl Step for RustAnalyzer {
941942
942943 fn run ( self , builder : & Builder < ' _ > ) -> ToolBuildResult {
943944 builder. ensure ( ToolBuild {
944- compiler : self . compiler ,
945+ build_compiler : self . compiler ,
945946 target : self . target ,
946947 tool : "rust-analyzer" ,
947948 mode : Mode :: ToolRustc ,
@@ -986,7 +987,7 @@ impl Step for RustAnalyzerProcMacroSrv {
986987
987988 fn run ( self , builder : & Builder < ' _ > ) -> Option < ToolBuildResult > {
988989 let tool_result = builder. ensure ( ToolBuild {
989- compiler : self . compiler ,
990+ build_compiler : self . compiler ,
990991 target : self . target ,
991992 tool : "rust-analyzer-proc-macro-srv" ,
992993 mode : Mode :: ToolRustc ,
@@ -1044,7 +1045,7 @@ impl Step for LlvmBitcodeLinker {
10441045 ) ]
10451046 fn run ( self , builder : & Builder < ' _ > ) -> ToolBuildResult {
10461047 let tool_result = builder. ensure ( ToolBuild {
1047- compiler : self . compiler ,
1048+ build_compiler : self . compiler ,
10481049 target : self . target ,
10491050 tool : "llvm-bitcode-linker" ,
10501051 mode : Mode :: ToolRustc ,
@@ -1241,7 +1242,7 @@ fn run_tool_build_step(
12411242
12421243 let ToolBuildResult { tool_path, build_compiler, target_compiler } =
12431244 builder. ensure ( ToolBuild {
1244- compiler,
1245+ build_compiler : compiler,
12451246 target,
12461247 tool : tool_name,
12471248 mode : Mode :: ToolRustc ,
@@ -1338,7 +1339,7 @@ impl Step for TestFloatParse {
13381339 let compiler = builder. compiler ( builder. top_stage , bootstrap_host) ;
13391340
13401341 builder. ensure ( ToolBuild {
1341- compiler,
1342+ build_compiler : compiler,
13421343 target : bootstrap_host,
13431344 tool : "test-float-parse" ,
13441345 mode : Mode :: ToolStd ,
0 commit comments