@@ -41,7 +41,8 @@ pub enum ToolArtifactKind {
41
41
42
42
#[ derive( Debug , Clone , Hash , PartialEq , Eq ) ]
43
43
struct ToolBuild {
44
- compiler : Compiler ,
44
+ /// Compiler that will build this tool.
45
+ build_compiler : Compiler ,
45
46
target : TargetSelection ,
46
47
tool : & ' static str ,
47
48
path : & ' static str ,
@@ -111,25 +112,25 @@ impl Step for ToolBuild {
111
112
let mut tool = self . tool ;
112
113
let path = self . path ;
113
114
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 )
117
118
} else {
118
- self . compiler
119
+ self . build_compiler
119
120
} ;
120
121
121
122
match self . mode {
122
123
Mode :: ToolRustc => {
123
124
// 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) ) ;
127
128
}
128
129
}
129
130
Mode :: ToolStd => {
130
131
// 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) ;
133
134
}
134
135
}
135
136
Mode :: ToolBootstrap => { } // uses downloaded stage0 compiler libs
@@ -151,7 +152,7 @@ impl Step for ToolBuild {
151
152
152
153
let mut cargo = prepare_tool_cargo (
153
154
builder,
154
- self . compiler ,
155
+ self . build_compiler ,
155
156
self . mode ,
156
157
target,
157
158
Kind :: Build ,
@@ -173,7 +174,7 @@ impl Step for ToolBuild {
173
174
174
175
// Rustc tools (miri, clippy, cargo, rustfmt, rust-analyzer)
175
176
// 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 ) {
177
178
let lto = match builder. config . rust_lto {
178
179
RustcLto :: Off => Some ( "off" ) ,
179
180
RustcLto :: Thin => Some ( "thin" ) ,
@@ -195,8 +196,8 @@ impl Step for ToolBuild {
195
196
Kind :: Build ,
196
197
self . mode ,
197
198
self . tool ,
198
- self . compiler . stage ,
199
- & self . compiler . host ,
199
+ self . build_compiler . stage ,
200
+ & self . build_compiler . host ,
200
201
& self . target ,
201
202
) ;
202
203
@@ -219,14 +220,14 @@ impl Step for ToolBuild {
219
220
}
220
221
let tool_path = match self . artifact_kind {
221
222
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)
223
224
}
224
225
ToolArtifactKind :: Library => builder
225
- . cargo_out ( self . compiler , self . mode , self . target )
226
+ . cargo_out ( self . build_compiler , self . mode , self . target )
226
227
. join ( format ! ( "lib{tool}.rlib" ) ) ,
227
228
} ;
228
229
229
- ToolBuildResult { tool_path, build_compiler : self . compiler , target_compiler }
230
+ ToolBuildResult { tool_path, build_compiler : self . build_compiler , target_compiler }
230
231
}
231
232
}
232
233
}
@@ -450,7 +451,7 @@ macro_rules! bootstrap_tool {
450
451
let compiletest_wants_stage0 = $tool_name == "compiletest" && builder. config. compiletest_use_stage0_libtest;
451
452
452
453
builder. ensure( ToolBuild {
453
- compiler : self . compiler,
454
+ build_compiler : self . compiler,
454
455
target: self . target,
455
456
tool: $tool_name,
456
457
mode: if is_unstable && !compiletest_wants_stage0 {
@@ -560,7 +561,7 @@ impl Step for RustcPerf {
560
561
builder. require_submodule ( "src/tools/rustc-perf" , None ) ;
561
562
562
563
let tool = ToolBuild {
563
- compiler : self . compiler ,
564
+ build_compiler : self . compiler ,
564
565
target : self . target ,
565
566
tool : "collector" ,
566
567
mode : Mode :: ToolBootstrap ,
@@ -576,7 +577,7 @@ impl Step for RustcPerf {
576
577
let res = builder. ensure ( tool. clone ( ) ) ;
577
578
// We also need to symlink the `rustc-fake` binary to the corresponding directory,
578
579
// 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" ) ;
580
581
581
582
res
582
583
}
@@ -620,7 +621,7 @@ impl Step for ErrorIndex {
620
621
621
622
fn run ( self , builder : & Builder < ' _ > ) -> ToolBuildResult {
622
623
builder. ensure ( ToolBuild {
623
- compiler : self . compiler ,
624
+ build_compiler : self . compiler ,
624
625
target : self . compiler . host ,
625
626
tool : "error_index_generator" ,
626
627
mode : Mode :: ToolRustc ,
@@ -656,7 +657,7 @@ impl Step for RemoteTestServer {
656
657
657
658
fn run ( self , builder : & Builder < ' _ > ) -> ToolBuildResult {
658
659
builder. ensure ( ToolBuild {
659
- compiler : self . compiler ,
660
+ build_compiler : self . compiler ,
660
661
target : self . target ,
661
662
tool : "remote-test-server" ,
662
663
mode : Mode :: ToolStd ,
@@ -757,7 +758,7 @@ impl Step for Rustdoc {
757
758
758
759
let ToolBuildResult { tool_path, build_compiler, target_compiler } =
759
760
builder. ensure ( ToolBuild {
760
- compiler : target_compiler,
761
+ build_compiler : target_compiler,
761
762
target,
762
763
// Cargo adds a number of paths to the dylib search path on windows, which results in
763
764
// the wrong rustdoc being executed. To avoid the conflicting rustdocs, we name the "tool"
@@ -825,7 +826,7 @@ impl Step for Cargo {
825
826
builder. build . require_submodule ( "src/tools/cargo" , None ) ;
826
827
827
828
builder. ensure ( ToolBuild {
828
- compiler : self . compiler ,
829
+ build_compiler : self . compiler ,
829
830
target : self . target ,
830
831
tool : "cargo" ,
831
832
mode : Mode :: ToolRustc ,
@@ -873,7 +874,7 @@ impl Step for LldWrapper {
873
874
let target = self . target_compiler . host ;
874
875
875
876
let tool_result = builder. ensure ( ToolBuild {
876
- compiler : self . build_compiler ,
877
+ build_compiler : self . build_compiler ,
877
878
target,
878
879
tool : "lld-wrapper" ,
879
880
mode : Mode :: ToolStd ,
@@ -948,7 +949,7 @@ impl Step for RustAnalyzer {
948
949
949
950
fn run ( self , builder : & Builder < ' _ > ) -> ToolBuildResult {
950
951
builder. ensure ( ToolBuild {
951
- compiler : self . compiler ,
952
+ build_compiler : self . compiler ,
952
953
target : self . target ,
953
954
tool : "rust-analyzer" ,
954
955
mode : Mode :: ToolRustc ,
@@ -993,7 +994,7 @@ impl Step for RustAnalyzerProcMacroSrv {
993
994
994
995
fn run ( self , builder : & Builder < ' _ > ) -> Option < ToolBuildResult > {
995
996
let tool_result = builder. ensure ( ToolBuild {
996
- compiler : self . compiler ,
997
+ build_compiler : self . compiler ,
997
998
target : self . target ,
998
999
tool : "rust-analyzer-proc-macro-srv" ,
999
1000
mode : Mode :: ToolRustc ,
@@ -1051,7 +1052,7 @@ impl Step for LlvmBitcodeLinker {
1051
1052
) ]
1052
1053
fn run ( self , builder : & Builder < ' _ > ) -> ToolBuildResult {
1053
1054
builder. ensure ( ToolBuild {
1054
- compiler : self . build_compiler ,
1055
+ build_compiler : self . build_compiler ,
1055
1056
target : self . target ,
1056
1057
tool : "llvm-bitcode-linker" ,
1057
1058
mode : Mode :: ToolRustc ,
@@ -1235,7 +1236,7 @@ fn run_tool_build_step(
1235
1236
1236
1237
let ToolBuildResult { tool_path, build_compiler, target_compiler } =
1237
1238
builder. ensure ( ToolBuild {
1238
- compiler,
1239
+ build_compiler : compiler,
1239
1240
target,
1240
1241
tool : tool_name,
1241
1242
mode : Mode :: ToolRustc ,
@@ -1332,7 +1333,7 @@ impl Step for TestFloatParse {
1332
1333
let compiler = builder. compiler ( builder. top_stage , bootstrap_host) ;
1333
1334
1334
1335
builder. ensure ( ToolBuild {
1335
- compiler,
1336
+ build_compiler : compiler,
1336
1337
target : bootstrap_host,
1337
1338
tool : "test-float-parse" ,
1338
1339
mode : Mode :: ToolStd ,
0 commit comments