@@ -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:: {
@@ -1133,7 +1133,7 @@ impl Step for Rustc {
1133
1133
cargo. env ( "RUSTC_BOLT_LINK_FLAGS" , "1" ) ;
1134
1134
}
1135
1135
1136
- let _guard = builder. msg_sysroot_tool (
1136
+ let _guard = builder. msg_rustc_tool (
1137
1137
Kind :: Build ,
1138
1138
build_compiler. stage ,
1139
1139
format_args ! ( "compiler artifacts{}" , crate_description( & self . crates) ) ,
@@ -1546,9 +1546,8 @@ impl Step for RustcLink {
1546
1546
1547
1547
#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
1548
1548
pub struct CodegenBackend {
1549
- pub target : TargetSelection ,
1550
- pub compiler : Compiler ,
1551
- pub backend : String ,
1549
+ compilers : RustcPrivateCompilers ,
1550
+ backend : String ,
1552
1551
}
1553
1552
1554
1553
fn needs_codegen_config ( run : & RunConfig < ' _ > ) -> bool {
@@ -1612,8 +1611,11 @@ impl Step for CodegenBackend {
1612
1611
}
1613
1612
1614
1613
run. builder . ensure ( CodegenBackend {
1615
- target : run. target ,
1616
- compiler : run. builder . compiler ( run. builder . top_stage , run. build_triple ( ) ) ,
1614
+ compilers : RustcPrivateCompilers :: new (
1615
+ run. builder ,
1616
+ run. builder . top_stage ,
1617
+ run. target ,
1618
+ ) ,
1617
1619
backend : backend. clone ( ) ,
1618
1620
} ) ;
1619
1621
}
@@ -1626,21 +1628,17 @@ impl Step for CodegenBackend {
1626
1628
name = "CodegenBackend::run" ,
1627
1629
skip_all,
1628
1630
fields(
1629
- compiler = ?self . compiler,
1630
- target = ?self . target,
1631
- backend = ?self . target,
1631
+ compilers = ?self . compilers,
1632
+ backend = ?self . backend,
1632
1633
) ,
1633
1634
) ,
1634
1635
) ]
1635
1636
fn run ( self , builder : & Builder < ' _ > ) {
1636
- let compiler = self . compiler ;
1637
- let target = self . target ;
1638
1637
let backend = self . backend ;
1638
+ let target = self . compilers . target ( ) ;
1639
+ let build_compiler = self . compilers . build_compiler ( ) ;
1639
1640
1640
- // FIXME: migrate to RustcPrivateCompilers
1641
- builder. ensure ( Rustc :: new ( compiler, target) ) ;
1642
-
1643
- if builder. config . keep_stage . contains ( & compiler. stage ) {
1641
+ if builder. config . keep_stage . contains ( & build_compiler. stage ) {
1644
1642
trace ! ( "`keep-stage` requested" ) ;
1645
1643
builder. info (
1646
1644
"WARNING: Using a potentially old codegen backend. \
@@ -1651,17 +1649,11 @@ impl Step for CodegenBackend {
1651
1649
return ;
1652
1650
}
1653
1651
1654
- let compiler_to_use = builder. compiler_for ( compiler. stage , compiler. host , target) ;
1655
- if compiler_to_use != compiler {
1656
- builder. ensure ( CodegenBackend { compiler : compiler_to_use, target, backend } ) ;
1657
- return ;
1658
- }
1659
-
1660
- let out_dir = builder. cargo_out ( compiler, Mode :: Codegen , target) ;
1652
+ let out_dir = builder. cargo_out ( build_compiler, Mode :: Codegen , target) ;
1661
1653
1662
1654
let mut cargo = builder:: Cargo :: new (
1663
1655
builder,
1664
- compiler ,
1656
+ build_compiler ,
1665
1657
Mode :: Codegen ,
1666
1658
SourceType :: InTree ,
1667
1659
target,
@@ -1682,7 +1674,13 @@ impl Step for CodegenBackend {
1682
1674
1683
1675
let tmp_stamp = BuildStamp :: new ( & out_dir) . with_prefix ( "tmp" ) ;
1684
1676
1685
- let _guard = builder. msg_build ( compiler, format_args ! ( "codegen backend {backend}" ) , target) ;
1677
+ let _guard = builder. msg_rustc_tool (
1678
+ Kind :: Build ,
1679
+ build_compiler. stage ,
1680
+ format_args ! ( "codegen backend {backend}" ) ,
1681
+ build_compiler. host ,
1682
+ target,
1683
+ ) ;
1686
1684
let files = run_cargo ( builder, cargo, vec ! [ ] , & tmp_stamp, vec ! [ ] , false , false ) ;
1687
1685
if builder. config . dry_run ( ) {
1688
1686
return ;
@@ -1702,15 +1700,18 @@ impl Step for CodegenBackend {
1702
1700
f. display( )
1703
1701
) ;
1704
1702
}
1705
- let stamp = build_stamp:: codegen_backend_stamp ( builder, compiler , target, & backend) ;
1703
+ let stamp = build_stamp:: codegen_backend_stamp ( builder, build_compiler , target, & backend) ;
1706
1704
let codegen_backend = codegen_backend. to_str ( ) . unwrap ( ) ;
1707
1705
t ! ( stamp. add_stamp( codegen_backend) . write( ) ) ;
1708
1706
}
1709
1707
1710
1708
fn metadata ( & self ) -> Option < StepMetadata > {
1711
1709
Some (
1712
- StepMetadata :: build ( & format ! ( "rustc_codegen_{}" , self . backend) , self . target )
1713
- . built_by ( self . compiler ) ,
1710
+ StepMetadata :: build (
1711
+ & format ! ( "rustc_codegen_{}" , self . backend) ,
1712
+ self . compilers . target ( ) ,
1713
+ )
1714
+ . built_by ( self . compilers . build_compiler ( ) ) ,
1714
1715
)
1715
1716
}
1716
1717
}
@@ -2199,8 +2200,10 @@ impl Step for Assemble {
2199
2200
continue ;
2200
2201
}
2201
2202
builder. ensure ( CodegenBackend {
2202
- compiler : build_compiler,
2203
- target : target_compiler. host ,
2203
+ compilers : RustcPrivateCompilers :: from_build_and_link_compiler (
2204
+ build_compiler,
2205
+ target_compiler,
2206
+ ) ,
2204
2207
backend : backend. clone ( ) ,
2205
2208
} ) ;
2206
2209
}
0 commit comments