@@ -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 } ;
@@ -431,13 +431,14 @@ impl Step for Rustc {
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" ) ;
@@ -1226,7 +1227,7 @@ impl Step for Cargo {
1226
1227
1227
1228
#[ derive( Debug , PartialOrd , Ord , Clone , Hash , PartialEq , Eq ) ]
1228
1229
pub struct RustAnalyzer {
1229
- pub compiler : Compiler ,
1230
+ pub build_compiler : Compiler ,
1230
1231
pub target : TargetSelection ,
1231
1232
}
1232
1233
@@ -1242,7 +1243,7 @@ impl Step for RustAnalyzer {
1242
1243
1243
1244
fn make_run ( run : RunConfig < ' _ > ) {
1244
1245
run. builder . ensure ( RustAnalyzer {
1245
- compiler : run. builder . compiler_for (
1246
+ build_compiler : run. builder . compiler_for (
1246
1247
run. builder . top_stage ,
1247
1248
run. builder . config . host_target ,
1248
1249
run. target ,
@@ -1252,12 +1253,11 @@ impl Step for RustAnalyzer {
1252
1253
}
1253
1254
1254
1255
fn run ( self , builder : & Builder < ' _ > ) -> Option < GeneratedTarball > {
1255
- let compiler = self . compiler ;
1256
1256
let target = self . target ;
1257
+ let compilers =
1258
+ RustcPrivateCompilers :: from_build_compiler ( builder, self . build_compiler , self . target ) ;
1257
1259
1258
- builder. ensure ( compile:: Rustc :: new ( compiler, target) ) ;
1259
-
1260
- let rust_analyzer = builder. ensure ( tool:: RustAnalyzer { compiler, target } ) ;
1260
+ let rust_analyzer = builder. ensure ( tool:: RustAnalyzer :: from_compilers ( compilers) ) ;
1261
1261
1262
1262
let mut tarball = Tarball :: new ( builder, "rust-analyzer" , & target. triple ) ;
1263
1263
tarball. set_overlay ( OverlayKind :: RustAnalyzer ) ;
@@ -1268,9 +1268,9 @@ impl Step for RustAnalyzer {
1268
1268
}
1269
1269
}
1270
1270
1271
- #[ derive( Debug , PartialOrd , Ord , Clone , Hash , PartialEq , Eq ) ]
1271
+ #[ derive( Debug , Clone , Hash , PartialEq , Eq ) ]
1272
1272
pub struct Clippy {
1273
- pub compiler : Compiler ,
1273
+ pub build_compiler : Compiler ,
1274
1274
pub target : TargetSelection ,
1275
1275
}
1276
1276
@@ -1286,7 +1286,7 @@ impl Step for Clippy {
1286
1286
1287
1287
fn make_run ( run : RunConfig < ' _ > ) {
1288
1288
run. builder . ensure ( Clippy {
1289
- compiler : run. builder . compiler_for (
1289
+ build_compiler : run. builder . compiler_for (
1290
1290
run. builder . top_stage ,
1291
1291
run. builder . config . host_target ,
1292
1292
run. target ,
@@ -1296,16 +1296,15 @@ impl Step for Clippy {
1296
1296
}
1297
1297
1298
1298
fn run ( self , builder : & Builder < ' _ > ) -> Option < GeneratedTarball > {
1299
- let compiler = self . compiler ;
1300
1299
let target = self . target ;
1301
-
1302
- builder . ensure ( compile :: Rustc :: new ( compiler , target) ) ;
1300
+ let compilers =
1301
+ RustcPrivateCompilers :: from_build_compiler ( builder , self . build_compiler , target) ;
1303
1302
1304
1303
// Prepare the image directory
1305
1304
// We expect clippy to build, because we've exited this step above if tool
1306
1305
// state for clippy isn't testing.
1307
- let clippy = builder. ensure ( tool:: Clippy { compiler , target } ) ;
1308
- 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 ) ) ;
1309
1308
1310
1309
let mut tarball = Tarball :: new ( builder, "clippy" , & target. triple ) ;
1311
1310
tarball. set_overlay ( OverlayKind :: Clippy ) ;
@@ -1317,9 +1316,9 @@ impl Step for Clippy {
1317
1316
}
1318
1317
}
1319
1318
1320
- #[ derive( Debug , PartialOrd , Ord , Clone , Hash , PartialEq , Eq ) ]
1319
+ #[ derive( Debug , Clone , Hash , PartialEq , Eq ) ]
1321
1320
pub struct Miri {
1322
- pub compiler : Compiler ,
1321
+ pub build_compiler : Compiler ,
1323
1322
pub target : TargetSelection ,
1324
1323
}
1325
1324
@@ -1335,7 +1334,7 @@ impl Step for Miri {
1335
1334
1336
1335
fn make_run ( run : RunConfig < ' _ > ) {
1337
1336
run. builder . ensure ( Miri {
1338
- compiler : run. builder . compiler_for (
1337
+ build_compiler : run. builder . compiler_for (
1339
1338
run. builder . top_stage ,
1340
1339
run. builder . config . host_target ,
1341
1340
run. target ,
@@ -1352,15 +1351,12 @@ impl Step for Miri {
1352
1351
return None ;
1353
1352
}
1354
1353
1355
- let compiler = self . compiler ;
1356
- let target = self . target ;
1357
-
1358
- builder. ensure ( compile:: Rustc :: new ( compiler, target) ) ;
1359
-
1360
- let miri = builder. ensure ( tool:: Miri { compiler, target } ) ;
1361
- let cargomiri = builder. ensure ( tool:: CargoMiri { 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) ) ;
1362
1358
1363
- let mut tarball = Tarball :: new ( builder, "miri" , & target. triple ) ;
1359
+ let mut tarball = Tarball :: new ( builder, "miri" , & self . target . triple ) ;
1364
1360
tarball. set_overlay ( OverlayKind :: Miri ) ;
1365
1361
tarball. is_preview ( true ) ;
1366
1362
tarball. add_file ( & miri. tool_path , "bin" , FileType :: Executable ) ;
@@ -1462,9 +1458,9 @@ impl Step for CodegenBackend {
1462
1458
}
1463
1459
}
1464
1460
1465
- #[ derive( Debug , PartialOrd , Ord , Clone , Hash , PartialEq , Eq ) ]
1461
+ #[ derive( Debug , Clone , Hash , PartialEq , Eq ) ]
1466
1462
pub struct Rustfmt {
1467
- pub compiler : Compiler ,
1463
+ pub build_compiler : Compiler ,
1468
1464
pub target : TargetSelection ,
1469
1465
}
1470
1466
@@ -1480,7 +1476,7 @@ impl Step for Rustfmt {
1480
1476
1481
1477
fn make_run ( run : RunConfig < ' _ > ) {
1482
1478
run. builder . ensure ( Rustfmt {
1483
- compiler : run. builder . compiler_for (
1479
+ build_compiler : run. builder . compiler_for (
1484
1480
run. builder . top_stage ,
1485
1481
run. builder . config . host_target ,
1486
1482
run. target ,
@@ -1490,14 +1486,13 @@ impl Step for Rustfmt {
1490
1486
}
1491
1487
1492
1488
fn run ( self , builder : & Builder < ' _ > ) -> Option < GeneratedTarball > {
1493
- let compiler = self . compiler ;
1494
- let target = self . target ;
1489
+ let compilers =
1490
+ RustcPrivateCompilers :: from_build_compiler ( builder , self . build_compiler , self . target ) ;
1495
1491
1496
- builder. ensure ( compile:: Rustc :: new ( compiler, target) ) ;
1492
+ let rustfmt = builder. ensure ( tool:: Rustfmt :: from_compilers ( compilers) ) ;
1493
+ let cargofmt = builder. ensure ( tool:: Cargofmt :: from_compilers ( compilers) ) ;
1497
1494
1498
- let rustfmt = builder. ensure ( tool:: Rustfmt { compiler, target } ) ;
1499
- let cargofmt = builder. ensure ( tool:: Cargofmt { compiler, target } ) ;
1500
- let mut tarball = Tarball :: new ( builder, "rustfmt" , & target. triple ) ;
1495
+ let mut tarball = Tarball :: new ( builder, "rustfmt" , & self . target . triple ) ;
1501
1496
tarball. set_overlay ( OverlayKind :: Rustfmt ) ;
1502
1497
tarball. is_preview ( true ) ;
1503
1498
tarball. add_file ( & rustfmt. tool_path , "bin" , FileType :: Executable ) ;
@@ -1565,11 +1560,11 @@ impl Step for Extended {
1565
1560
add_component ! ( "rust-docs" => Docs { host: target } ) ;
1566
1561
add_component ! ( "rust-json-docs" => JsonDocs { host: target } ) ;
1567
1562
add_component ! ( "cargo" => Cargo { compiler, target } ) ;
1568
- add_component ! ( "rustfmt" => Rustfmt { compiler, target } ) ;
1569
- add_component ! ( "rust-analyzer" => RustAnalyzer { compiler, target } ) ;
1563
+ add_component ! ( "rustfmt" => Rustfmt { build_compiler : compiler, target } ) ;
1564
+ add_component ! ( "rust-analyzer" => RustAnalyzer { build_compiler : compiler, target } ) ;
1570
1565
add_component ! ( "llvm-components" => LlvmTools { target } ) ;
1571
- add_component ! ( "clippy" => Clippy { compiler, target } ) ;
1572
- add_component ! ( "miri" => Miri { compiler, target } ) ;
1566
+ add_component ! ( "clippy" => Clippy { build_compiler : compiler, target } ) ;
1567
+ add_component ! ( "miri" => Miri { build_compiler : compiler, target } ) ;
1573
1568
add_component ! ( "analysis" => Analysis { compiler, target } ) ;
1574
1569
add_component ! ( "rustc-codegen-cranelift" => CodegenBackend {
1575
1570
compiler: builder. compiler( stage, target) ,
0 commit comments