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