@@ -20,7 +20,7 @@ use object::read::archive::ArchiveFile;
20
20
use tracing:: instrument;
21
21
22
22
use crate :: core:: build_steps:: doc:: DocumentationFormat ;
23
- use crate :: core:: build_steps:: tool:: { self , Tool } ;
23
+ use crate :: core:: build_steps:: tool:: { self , RustcPrivateCompilers , Tool } ;
24
24
use crate :: core:: build_steps:: vendor:: { VENDOR_DIR , Vendor } ;
25
25
use crate :: core:: build_steps:: { compile, llvm} ;
26
26
use crate :: core:: builder:: { Builder , Kind , RunConfig , ShouldRun , Step , StepMetadata } ;
@@ -425,19 +425,20 @@ impl Step for Rustc {
425
425
. as_ref ( )
426
426
. is_none_or ( |tools| tools. iter ( ) . any ( |tool| tool == "rustdoc" ) )
427
427
{
428
- let rustdoc = builder. rustdoc ( compiler) ;
428
+ let rustdoc = builder. rustdoc_for_compiler ( compiler) ;
429
429
builder. install ( & rustdoc, & image. join ( "bin" ) , FileType :: Executable ) ;
430
430
}
431
431
432
432
let ra_proc_macro_srv_compiler =
433
433
builder. compiler_for ( compiler. stage , builder. config . host_target , compiler. host ) ;
434
- builder. ensure ( compile:: Rustc :: new ( ra_proc_macro_srv_compiler, compiler. host ) ) ;
434
+ let compilers = RustcPrivateCompilers :: from_build_compiler (
435
+ builder,
436
+ ra_proc_macro_srv_compiler,
437
+ compiler. host ,
438
+ ) ;
435
439
436
440
if let Some ( ra_proc_macro_srv) = builder. ensure_if_default (
437
- tool:: RustAnalyzerProcMacroSrv {
438
- compiler : ra_proc_macro_srv_compiler,
439
- target : compiler. host ,
440
- } ,
441
+ tool:: RustAnalyzerProcMacroSrv :: from_compilers ( compilers) ,
441
442
builder. kind ,
442
443
) {
443
444
let dst = image. join ( "libexec" ) ;
@@ -1172,7 +1173,7 @@ impl Step for PlainSourceTarball {
1172
1173
1173
1174
#[ derive( Debug , PartialOrd , Ord , Clone , Hash , PartialEq , Eq ) ]
1174
1175
pub struct Cargo {
1175
- pub compiler : Compiler ,
1176
+ pub build_compiler : Compiler ,
1176
1177
pub target : TargetSelection ,
1177
1178
}
1178
1179
@@ -1188,7 +1189,7 @@ impl Step for Cargo {
1188
1189
1189
1190
fn make_run ( run : RunConfig < ' _ > ) {
1190
1191
run. builder . ensure ( Cargo {
1191
- compiler : run. builder . compiler_for (
1192
+ build_compiler : run. builder . compiler_for (
1192
1193
run. builder . top_stage ,
1193
1194
run. builder . config . host_target ,
1194
1195
run. target ,
@@ -1198,12 +1199,10 @@ impl Step for Cargo {
1198
1199
}
1199
1200
1200
1201
fn run ( self , builder : & Builder < ' _ > ) -> Option < GeneratedTarball > {
1201
- let compiler = self . compiler ;
1202
+ let build_compiler = self . build_compiler ;
1202
1203
let target = self . target ;
1203
1204
1204
- builder. ensure ( compile:: Rustc :: new ( compiler, target) ) ;
1205
-
1206
- let cargo = builder. ensure ( tool:: Cargo { compiler, target } ) ;
1205
+ let cargo = builder. ensure ( tool:: Cargo :: from_build_compiler ( build_compiler, target) ) ;
1207
1206
let src = builder. src . join ( "src/tools/cargo" ) ;
1208
1207
let etc = src. join ( "src/etc" ) ;
1209
1208
@@ -1228,7 +1227,7 @@ impl Step for Cargo {
1228
1227
1229
1228
#[ derive( Debug , PartialOrd , Ord , Clone , Hash , PartialEq , Eq ) ]
1230
1229
pub struct RustAnalyzer {
1231
- pub compiler : Compiler ,
1230
+ pub build_compiler : Compiler ,
1232
1231
pub target : TargetSelection ,
1233
1232
}
1234
1233
@@ -1244,7 +1243,7 @@ impl Step for RustAnalyzer {
1244
1243
1245
1244
fn make_run ( run : RunConfig < ' _ > ) {
1246
1245
run. builder . ensure ( RustAnalyzer {
1247
- compiler : run. builder . compiler_for (
1246
+ build_compiler : run. builder . compiler_for (
1248
1247
run. builder . top_stage ,
1249
1248
run. builder . config . host_target ,
1250
1249
run. target ,
@@ -1254,12 +1253,11 @@ impl Step for RustAnalyzer {
1254
1253
}
1255
1254
1256
1255
fn run ( self , builder : & Builder < ' _ > ) -> Option < GeneratedTarball > {
1257
- let compiler = self . compiler ;
1258
1256
let target = self . target ;
1257
+ let compilers =
1258
+ RustcPrivateCompilers :: from_build_compiler ( builder, self . build_compiler , self . target ) ;
1259
1259
1260
- builder. ensure ( compile:: Rustc :: new ( compiler, target) ) ;
1261
-
1262
- let rust_analyzer = builder. ensure ( tool:: RustAnalyzer { compiler, target } ) ;
1260
+ let rust_analyzer = builder. ensure ( tool:: RustAnalyzer :: from_compilers ( compilers) ) ;
1263
1261
1264
1262
let mut tarball = Tarball :: new ( builder, "rust-analyzer" , & target. triple ) ;
1265
1263
tarball. set_overlay ( OverlayKind :: RustAnalyzer ) ;
@@ -1270,9 +1268,9 @@ impl Step for RustAnalyzer {
1270
1268
}
1271
1269
}
1272
1270
1273
- #[ derive( Debug , PartialOrd , Ord , Clone , Hash , PartialEq , Eq ) ]
1271
+ #[ derive( Debug , Clone , Hash , PartialEq , Eq ) ]
1274
1272
pub struct Clippy {
1275
- pub compiler : Compiler ,
1273
+ pub build_compiler : Compiler ,
1276
1274
pub target : TargetSelection ,
1277
1275
}
1278
1276
@@ -1288,7 +1286,7 @@ impl Step for Clippy {
1288
1286
1289
1287
fn make_run ( run : RunConfig < ' _ > ) {
1290
1288
run. builder . ensure ( Clippy {
1291
- compiler : run. builder . compiler_for (
1289
+ build_compiler : run. builder . compiler_for (
1292
1290
run. builder . top_stage ,
1293
1291
run. builder . config . host_target ,
1294
1292
run. target ,
@@ -1298,16 +1296,15 @@ impl Step for Clippy {
1298
1296
}
1299
1297
1300
1298
fn run ( self , builder : & Builder < ' _ > ) -> Option < GeneratedTarball > {
1301
- let compiler = self . compiler ;
1302
1299
let target = self . target ;
1303
-
1304
- builder . ensure ( compile :: Rustc :: new ( compiler , target) ) ;
1300
+ let compilers =
1301
+ RustcPrivateCompilers :: from_build_compiler ( builder , self . build_compiler , target) ;
1305
1302
1306
1303
// Prepare the image directory
1307
1304
// We expect clippy to build, because we've exited this step above if tool
1308
1305
// state for clippy isn't testing.
1309
- let clippy = builder. ensure ( tool:: Clippy { compiler , target } ) ;
1310
- let cargoclippy = builder. ensure ( tool:: CargoClippy { compiler , target } ) ;
1306
+ let clippy = builder. ensure ( tool:: Clippy :: from_compilers ( compilers ) ) ;
1307
+ let cargoclippy = builder. ensure ( tool:: CargoClippy :: from_compilers ( compilers ) ) ;
1311
1308
1312
1309
let mut tarball = Tarball :: new ( builder, "clippy" , & target. triple ) ;
1313
1310
tarball. set_overlay ( OverlayKind :: Clippy ) ;
@@ -1319,9 +1316,9 @@ impl Step for Clippy {
1319
1316
}
1320
1317
}
1321
1318
1322
- #[ derive( Debug , PartialOrd , Ord , Clone , Hash , PartialEq , Eq ) ]
1319
+ #[ derive( Debug , Clone , Hash , PartialEq , Eq ) ]
1323
1320
pub struct Miri {
1324
- pub compiler : Compiler ,
1321
+ pub build_compiler : Compiler ,
1325
1322
pub target : TargetSelection ,
1326
1323
}
1327
1324
@@ -1337,7 +1334,7 @@ impl Step for Miri {
1337
1334
1338
1335
fn make_run ( run : RunConfig < ' _ > ) {
1339
1336
run. builder . ensure ( Miri {
1340
- compiler : run. builder . compiler_for (
1337
+ build_compiler : run. builder . compiler_for (
1341
1338
run. builder . top_stage ,
1342
1339
run. builder . config . host_target ,
1343
1340
run. target ,
@@ -1354,15 +1351,12 @@ impl Step for Miri {
1354
1351
return None ;
1355
1352
}
1356
1353
1357
- let compiler = self . compiler ;
1358
- let target = self . target ;
1359
-
1360
- builder. ensure ( compile :: Rustc :: new ( compiler , target ) ) ;
1354
+ let compilers =
1355
+ RustcPrivateCompilers :: from_build_compiler ( builder , self . build_compiler , self . target ) ;
1356
+ let miri = builder . ensure ( tool :: Miri :: from_compilers ( compilers ) ) ;
1357
+ let cargomiri = builder. ensure ( tool :: CargoMiri :: from_compilers ( compilers ) ) ;
1361
1358
1362
- let miri = builder. ensure ( tool:: Miri { compiler, target } ) ;
1363
- let cargomiri = builder. ensure ( tool:: CargoMiri { compiler, target } ) ;
1364
-
1365
- let mut tarball = Tarball :: new ( builder, "miri" , & target. triple ) ;
1359
+ let mut tarball = Tarball :: new ( builder, "miri" , & self . target . triple ) ;
1366
1360
tarball. set_overlay ( OverlayKind :: Miri ) ;
1367
1361
tarball. is_preview ( true ) ;
1368
1362
tarball. add_file ( & miri. tool_path , "bin" , FileType :: Executable ) ;
@@ -1466,9 +1460,9 @@ impl Step for CodegenBackend {
1466
1460
}
1467
1461
}
1468
1462
1469
- #[ derive( Debug , PartialOrd , Ord , Clone , Hash , PartialEq , Eq ) ]
1463
+ #[ derive( Debug , Clone , Hash , PartialEq , Eq ) ]
1470
1464
pub struct Rustfmt {
1471
- pub compiler : Compiler ,
1465
+ pub build_compiler : Compiler ,
1472
1466
pub target : TargetSelection ,
1473
1467
}
1474
1468
@@ -1484,7 +1478,7 @@ impl Step for Rustfmt {
1484
1478
1485
1479
fn make_run ( run : RunConfig < ' _ > ) {
1486
1480
run. builder . ensure ( Rustfmt {
1487
- compiler : run. builder . compiler_for (
1481
+ build_compiler : run. builder . compiler_for (
1488
1482
run. builder . top_stage ,
1489
1483
run. builder . config . host_target ,
1490
1484
run. target ,
@@ -1494,14 +1488,13 @@ impl Step for Rustfmt {
1494
1488
}
1495
1489
1496
1490
fn run ( self , builder : & Builder < ' _ > ) -> Option < GeneratedTarball > {
1497
- let compiler = self . compiler ;
1498
- let target = self . target ;
1491
+ let compilers =
1492
+ RustcPrivateCompilers :: from_build_compiler ( builder , self . build_compiler , self . target ) ;
1499
1493
1500
- builder. ensure ( compile:: Rustc :: new ( compiler, target) ) ;
1494
+ let rustfmt = builder. ensure ( tool:: Rustfmt :: from_compilers ( compilers) ) ;
1495
+ let cargofmt = builder. ensure ( tool:: Cargofmt :: from_compilers ( compilers) ) ;
1501
1496
1502
- let rustfmt = builder. ensure ( tool:: Rustfmt { compiler, target } ) ;
1503
- let cargofmt = builder. ensure ( tool:: Cargofmt { compiler, target } ) ;
1504
- let mut tarball = Tarball :: new ( builder, "rustfmt" , & target. triple ) ;
1497
+ let mut tarball = Tarball :: new ( builder, "rustfmt" , & self . target . triple ) ;
1505
1498
tarball. set_overlay ( OverlayKind :: Rustfmt ) ;
1506
1499
tarball. is_preview ( true ) ;
1507
1500
tarball. add_file ( & rustfmt. tool_path , "bin" , FileType :: Executable ) ;
@@ -1548,7 +1541,7 @@ impl Step for Extended {
1548
1541
let mut built_tools = HashSet :: new ( ) ;
1549
1542
macro_rules! add_component {
1550
1543
( $name: expr => $step: expr) => {
1551
- if let Some ( tarball) = builder. ensure_if_default( $step, Kind :: Dist ) {
1544
+ if let Some ( Some ( tarball) ) = builder. ensure_if_default( $step, Kind :: Dist ) {
1552
1545
tarballs. push( tarball) ;
1553
1546
built_tools. insert( $name) ;
1554
1547
}
@@ -1568,12 +1561,12 @@ impl Step for Extended {
1568
1561
1569
1562
add_component ! ( "rust-docs" => Docs { host: target } ) ;
1570
1563
add_component ! ( "rust-json-docs" => JsonDocs { host: target } ) ;
1571
- add_component ! ( "cargo" => Cargo { compiler, target } ) ;
1572
- add_component ! ( "rustfmt" => Rustfmt { compiler, target } ) ;
1573
- add_component ! ( "rust-analyzer" => RustAnalyzer { compiler, target } ) ;
1564
+ add_component ! ( "cargo" => Cargo { build_compiler : compiler, target } ) ;
1565
+ add_component ! ( "rustfmt" => Rustfmt { build_compiler : compiler, target } ) ;
1566
+ add_component ! ( "rust-analyzer" => RustAnalyzer { build_compiler : compiler, target } ) ;
1574
1567
add_component ! ( "llvm-components" => LlvmTools { target } ) ;
1575
- add_component ! ( "clippy" => Clippy { compiler, target } ) ;
1576
- add_component ! ( "miri" => Miri { compiler, target } ) ;
1568
+ add_component ! ( "clippy" => Clippy { build_compiler : compiler, target } ) ;
1569
+ add_component ! ( "miri" => Miri { build_compiler : compiler, target } ) ;
1577
1570
add_component ! ( "analysis" => Analysis { compiler, target } ) ;
1578
1571
add_component ! ( "rustc-codegen-cranelift" => CodegenBackend {
1579
1572
compiler: builder. compiler( stage, target) ,
0 commit comments