@@ -1541,6 +1541,8 @@ impl Step for RustcLink {
1541
1541
}
1542
1542
}
1543
1543
1544
+ pub const RUSTC_CODEGEN_GCC : & str = "rustc_codegen_gcc" ;
1545
+
1544
1546
#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
1545
1547
pub struct GccCodegenBackend {
1546
1548
compilers : RustcPrivateCompilers ,
@@ -1551,7 +1553,7 @@ impl Step for GccCodegenBackend {
1551
1553
const ONLY_HOSTS : bool = true ;
1552
1554
1553
1555
fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
1554
- run. alias ( "rustc_codegen_gcc" ) . alias ( "cg_gcc" )
1556
+ run. alias ( RUSTC_CODEGEN_GCC ) . alias ( "cg_gcc" )
1555
1557
}
1556
1558
1557
1559
fn make_run ( run : RunConfig < ' _ > ) {
@@ -1610,7 +1612,7 @@ impl Step for GccCodegenBackend {
1610
1612
let _guard = builder. msg_rustc_tool (
1611
1613
Kind :: Build ,
1612
1614
build_compiler. stage ,
1613
- format_args ! ( "codegen backend gcc" ) ,
1615
+ "codegen backend gcc" ,
1614
1616
build_compiler. host ,
1615
1617
target,
1616
1618
) ;
@@ -1620,12 +1622,14 @@ impl Step for GccCodegenBackend {
1620
1622
1621
1623
fn metadata ( & self ) -> Option < StepMetadata > {
1622
1624
Some (
1623
- StepMetadata :: build ( "rustc_codegen_gcc" , self . compilers . target ( ) )
1625
+ StepMetadata :: build ( RUSTC_CODEGEN_GCC , self . compilers . target ( ) )
1624
1626
. built_by ( self . compilers . build_compiler ( ) ) ,
1625
1627
)
1626
1628
}
1627
1629
}
1628
1630
1631
+ pub const RUSTC_CODEGEN_CRANELIFT : & str = "rustc_codegen_cranelift" ;
1632
+
1629
1633
#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
1630
1634
pub struct CraneliftCodegenBackend {
1631
1635
pub compilers : RustcPrivateCompilers ,
@@ -1636,7 +1640,7 @@ impl Step for CraneliftCodegenBackend {
1636
1640
const ONLY_HOSTS : bool = true ;
1637
1641
1638
1642
fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
1639
- run. alias ( "rustc_codegen_cranelift" ) . alias ( "cg_clif" )
1643
+ run. alias ( RUSTC_CODEGEN_CRANELIFT ) . alias ( "cg_clif" )
1640
1644
}
1641
1645
1642
1646
fn make_run ( run : RunConfig < ' _ > ) {
@@ -1688,13 +1692,13 @@ impl Step for CraneliftCodegenBackend {
1688
1692
) ;
1689
1693
cargo
1690
1694
. arg ( "--manifest-path" )
1691
- . arg ( builder. src . join ( "compiler/rustc_codegen_cranelift /Cargo.toml" ) ) ;
1695
+ . arg ( builder. src . join ( format ! ( "compiler/{RUSTC_CODEGEN_CRANELIFT} /Cargo.toml" ) ) ) ;
1692
1696
rustc_cargo_env ( builder, & mut cargo, target) ;
1693
1697
1694
1698
let _guard = builder. msg_rustc_tool (
1695
1699
Kind :: Build ,
1696
1700
build_compiler. stage ,
1697
- format_args ! ( "codegen backend cranelift" ) ,
1701
+ "codegen backend cranelift" ,
1698
1702
build_compiler. host ,
1699
1703
target,
1700
1704
) ;
@@ -1704,7 +1708,7 @@ impl Step for CraneliftCodegenBackend {
1704
1708
1705
1709
fn metadata ( & self ) -> Option < StepMetadata > {
1706
1710
Some (
1707
- StepMetadata :: build ( "rustc_codegen_cranelift" , self . compilers . target ( ) )
1711
+ StepMetadata :: build ( RUSTC_CODEGEN_CRANELIFT , self . compilers . target ( ) )
1708
1712
. built_by ( self . compilers . build_compiler ( ) ) ,
1709
1713
)
1710
1714
}
@@ -1716,32 +1720,28 @@ fn write_codegen_backend_stamp(
1716
1720
files : Vec < PathBuf > ,
1717
1721
dry_run : bool ,
1718
1722
) -> BuildStamp {
1719
- if !dry_run {
1720
- let mut files = files. into_iter ( ) . filter ( |f| {
1721
- let filename = f. file_name ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) ;
1722
- is_dylib ( f) && filename. contains ( "rustc_codegen_" )
1723
- } ) ;
1724
- let codegen_backend = match files. next ( ) {
1725
- Some ( f) => f,
1726
- None => panic ! ( "no dylibs built for codegen backend?" ) ,
1727
- } ;
1728
- if let Some ( f) = files. next ( ) {
1729
- panic ! (
1730
- "codegen backend built two dylibs:\n {}\n {}" ,
1731
- codegen_backend. display( ) ,
1732
- f. display( )
1733
- ) ;
1734
- }
1723
+ if dry_run {
1724
+ return stamp;
1725
+ }
1735
1726
1736
- let codegen_backend = codegen_backend. to_str ( ) . unwrap ( ) ;
1737
- stamp = stamp. add_stamp ( codegen_backend) ;
1738
- t ! ( stamp. write( ) ) ;
1727
+ let mut files = files. into_iter ( ) . filter ( |f| {
1728
+ let filename = f. file_name ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) ;
1729
+ is_dylib ( f) && filename. contains ( "rustc_codegen_" )
1730
+ } ) ;
1731
+ let codegen_backend = match files. next ( ) {
1732
+ Some ( f) => f,
1733
+ None => panic ! ( "no dylibs built for codegen backend?" ) ,
1734
+ } ;
1735
+ if let Some ( f) = files. next ( ) {
1736
+ panic ! ( "codegen backend built two dylibs:\n {}\n {}" , codegen_backend. display( ) , f. display( ) ) ;
1739
1737
}
1738
+
1739
+ let codegen_backend = codegen_backend. to_str ( ) . unwrap ( ) ;
1740
+ stamp = stamp. add_stamp ( codegen_backend) ;
1741
+ t ! ( stamp. write( ) ) ;
1740
1742
stamp
1741
1743
}
1742
1744
1743
- pub ( crate ) const CODEGEN_BACKEND_PREFIX : & str = "rustc_codegen_" ;
1744
-
1745
1745
/// Creates the `codegen-backends` folder for a compiler that's about to be
1746
1746
/// assembled as a complete compiler.
1747
1747
///
0 commit comments