@@ -19,7 +19,7 @@ use serde_derive::Deserialize;
19
19
use tracing:: { instrument, span} ;
20
20
21
21
use crate :: core:: build_steps:: gcc:: { Gcc , add_cg_gcc_cargo_flags} ;
22
- use crate :: core:: build_steps:: tool:: { SourceType , copy_lld_artifacts} ;
22
+ use crate :: core:: build_steps:: tool:: { RustcPrivateCompilers , SourceType , copy_lld_artifacts} ;
23
23
use crate :: core:: build_steps:: { dist, llvm} ;
24
24
use crate :: core:: builder;
25
25
use crate :: core:: builder:: {
@@ -1131,7 +1131,7 @@ impl Step for Rustc {
1131
1131
cargo. env ( "RUSTC_BOLT_LINK_FLAGS" , "1" ) ;
1132
1132
}
1133
1133
1134
- let _guard = builder. msg_sysroot_tool (
1134
+ let _guard = builder. msg_rustc_tool (
1135
1135
Kind :: Build ,
1136
1136
build_compiler. stage ,
1137
1137
format_args ! ( "compiler artifacts{}" , crate_description( & self . crates) ) ,
@@ -1544,9 +1544,8 @@ impl Step for RustcLink {
1544
1544
1545
1545
#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
1546
1546
pub struct CodegenBackend {
1547
- pub target : TargetSelection ,
1548
- pub compiler : Compiler ,
1549
- pub backend : CodegenBackendKind ,
1547
+ compilers : RustcPrivateCompilers ,
1548
+ backend : CodegenBackendKind ,
1550
1549
}
1551
1550
1552
1551
fn needs_codegen_config ( run : & RunConfig < ' _ > ) -> bool {
@@ -1610,8 +1609,11 @@ impl Step for CodegenBackend {
1610
1609
}
1611
1610
1612
1611
run. builder . ensure ( CodegenBackend {
1613
- target : run. target ,
1614
- compiler : run. builder . compiler ( run. builder . top_stage , run. build_triple ( ) ) ,
1612
+ compilers : RustcPrivateCompilers :: new (
1613
+ run. builder ,
1614
+ run. builder . top_stage ,
1615
+ run. target ,
1616
+ ) ,
1615
1617
backend : backend. clone ( ) ,
1616
1618
} ) ;
1617
1619
}
@@ -1624,21 +1626,17 @@ impl Step for CodegenBackend {
1624
1626
name = "CodegenBackend::run" ,
1625
1627
skip_all,
1626
1628
fields(
1627
- compiler = ?self . compiler,
1628
- target = ?self . target,
1629
- backend = ?self . target,
1629
+ compilers = ?self . compilers,
1630
+ backend = ?self . backend,
1630
1631
) ,
1631
1632
) ,
1632
1633
) ]
1633
1634
fn run ( self , builder : & Builder < ' _ > ) {
1634
- let compiler = self . compiler ;
1635
- let target = self . target ;
1636
1635
let backend = self . backend ;
1636
+ let target = self . compilers . target ( ) ;
1637
+ let build_compiler = self . compilers . build_compiler ( ) ;
1637
1638
1638
- // FIXME: migrate to RustcPrivateCompilers
1639
- builder. ensure ( Rustc :: new ( compiler, target) ) ;
1640
-
1641
- if builder. config . keep_stage . contains ( & compiler. stage ) {
1639
+ if builder. config . keep_stage . contains ( & build_compiler. stage ) {
1642
1640
trace ! ( "`keep-stage` requested" ) ;
1643
1641
builder. info (
1644
1642
"WARNING: Using a potentially old codegen backend. \
@@ -1649,17 +1647,11 @@ impl Step for CodegenBackend {
1649
1647
return ;
1650
1648
}
1651
1649
1652
- let compiler_to_use = builder. compiler_for ( compiler. stage , compiler. host , target) ;
1653
- if compiler_to_use != compiler {
1654
- builder. ensure ( CodegenBackend { compiler : compiler_to_use, target, backend } ) ;
1655
- return ;
1656
- }
1657
-
1658
- let out_dir = builder. cargo_out ( compiler, Mode :: Codegen , target) ;
1650
+ let out_dir = builder. cargo_out ( build_compiler, Mode :: Codegen , target) ;
1659
1651
1660
1652
let mut cargo = builder:: Cargo :: new (
1661
1653
builder,
1662
- compiler ,
1654
+ build_compiler ,
1663
1655
Mode :: Codegen ,
1664
1656
SourceType :: InTree ,
1665
1657
target,
@@ -1680,8 +1672,13 @@ impl Step for CodegenBackend {
1680
1672
1681
1673
let tmp_stamp = BuildStamp :: new ( & out_dir) . with_prefix ( "tmp" ) ;
1682
1674
1683
- let _guard =
1684
- builder. msg_build ( compiler, format_args ! ( "codegen backend {}" , backend. name( ) ) , target) ;
1675
+ let _guard = builder. msg_rustc_tool (
1676
+ Kind :: Build ,
1677
+ build_compiler. stage ,
1678
+ format_args ! ( "codegen backend {}" , backend. name( ) ) ,
1679
+ build_compiler. host ,
1680
+ target,
1681
+ ) ;
1685
1682
let files = run_cargo ( builder, cargo, vec ! [ ] , & tmp_stamp, vec ! [ ] , false , false ) ;
1686
1683
if builder. config . dry_run ( ) {
1687
1684
return ;
@@ -1701,15 +1698,15 @@ impl Step for CodegenBackend {
1701
1698
f. display( )
1702
1699
) ;
1703
1700
}
1704
- let stamp = build_stamp:: codegen_backend_stamp ( builder, compiler , target, & backend) ;
1701
+ let stamp = build_stamp:: codegen_backend_stamp ( builder, build_compiler , target, & backend) ;
1705
1702
let codegen_backend = codegen_backend. to_str ( ) . unwrap ( ) ;
1706
1703
t ! ( stamp. add_stamp( codegen_backend) . write( ) ) ;
1707
1704
}
1708
1705
1709
1706
fn metadata ( & self ) -> Option < StepMetadata > {
1710
1707
Some (
1711
- StepMetadata :: build ( & format ! ( "rustc_codegen_{}" , self . backend) , self . target )
1712
- . built_by ( self . compiler ) ,
1708
+ StepMetadata :: build ( & self . backend . crate_name ( ) , self . compilers . target ( ) )
1709
+ . built_by ( self . compilers . build_compiler ( ) ) ,
1713
1710
)
1714
1711
}
1715
1712
}
@@ -2198,8 +2195,10 @@ impl Step for Assemble {
2198
2195
continue ;
2199
2196
}
2200
2197
builder. ensure ( CodegenBackend {
2201
- compiler : build_compiler,
2202
- target : target_compiler. host ,
2198
+ compilers : RustcPrivateCompilers :: from_build_and_link_compiler (
2199
+ build_compiler,
2200
+ target_compiler,
2201
+ ) ,
2203
2202
backend : backend. clone ( ) ,
2204
2203
} ) ;
2205
2204
}
0 commit comments