@@ -29,14 +29,15 @@ use crate::core::build_steps::tool::{
2929} ;
3030use crate :: core:: build_steps:: vendor:: { VENDOR_DIR , Vendor } ;
3131use crate :: core:: build_steps:: { compile, llvm} ;
32- use crate :: core:: builder:: { Builder , Kind , RunConfig , ShouldRun , Step , StepMetadata } ;
32+ use crate :: core:: builder:: {
33+ Builder , Kind , MakeOrEnsure , RunConfig , ShouldRun , Step , StepMetadata , SupportedConfig ,
34+ Unsupported ,
35+ } ;
3336use crate :: core:: config:: { GccCiMode , TargetSelection } ;
3437use crate :: utils:: build_stamp:: { self , BuildStamp } ;
3538use crate :: utils:: channel:: { self , Info } ;
3639use crate :: utils:: exec:: { BootstrapCommand , command} ;
37- use crate :: utils:: helpers:: {
38- exe, is_dylib, move_file, t, target_supports_cranelift_backend, timeit,
39- } ;
40+ use crate :: utils:: helpers:: { exe, is_dylib, move_file, t, timeit} ;
4041use crate :: utils:: tarball:: { GeneratedTarball , OverlayKind , Tarball } ;
4142use crate :: { CodegenBackendKind , Compiler , DependencyType , FileType , LLVM_TOOLS , Mode , trace} ;
4243
@@ -432,12 +433,20 @@ impl Step for Mingw {
432433 run. builder . ensure ( Mingw { target : run. target } ) ;
433434 }
434435
435- fn run ( self , builder : & Builder < ' _ > ) -> Option < GeneratedTarball > {
436- let target = self . target ;
437- if !target. contains ( "pc-windows-gnu" ) || !builder. config . dist_include_mingw_linker {
438- return None ;
436+ fn is_supported ( config : SupportedConfig < ' _ , Self > ) -> Result < ( ) , Unsupported < Self :: Output > > {
437+ let target = match config. extra {
438+ MakeOrEnsure :: Run ( run) => run. target ,
439+ MakeOrEnsure :: Step ( this) => this. target ,
440+ } ;
441+ if !target. contains ( "pc-windows-gnu" ) || !config. builder . config . dist_include_mingw_linker {
442+ Unsupported :: skip ( "not a windows-gnu and `dist.include_mingw_linker` not enabled" )
443+ } else {
444+ Ok ( ( ) )
439445 }
446+ }
440447
448+ fn run ( self , builder : & Builder < ' _ > ) -> Option < GeneratedTarball > {
449+ let target = self . target ;
441450 let mut tarball = Tarball :: new ( builder, "rust-mingw" , & target. triple ) ;
442451 tarball. set_product_name ( "Rust MinGW" ) ;
443452
@@ -1571,14 +1580,18 @@ impl Step for Miri {
15711580 } ) ;
15721581 }
15731582
1574- fn run ( self , builder : & Builder < ' _ > ) -> Option < GeneratedTarball > {
1583+ fn is_supported ( config : SupportedConfig < ' _ , Self > ) -> Result < ( ) , Unsupported < Self :: Output > > {
15751584 // This prevents miri from being built for "dist" or "install"
15761585 // on the stable/beta channels. It is a nightly-only tool and should
15771586 // not be included.
1578- if !builder. build . unstable_features ( ) {
1579- return None ;
1587+ if !config. builder . unstable_features ( ) {
1588+ Unsupported :: skip ( "miri is nightly-only and is not shipped on beta or stable" )
1589+ } else {
1590+ Ok ( ( ) )
15801591 }
1592+ }
15811593
1594+ fn run ( self , builder : & Builder < ' _ > ) -> Option < GeneratedTarball > {
15821595 let miri = builder. ensure ( tool:: Miri :: from_compilers ( self . compilers ) ) ;
15831596 let cargomiri = builder. ensure ( tool:: CargoMiri :: from_compilers ( self . compilers ) ) ;
15841597
@@ -1637,7 +1650,7 @@ impl Step for CraneliftCodegenBackend {
16371650 }
16381651
16391652 let target = self . target ;
1640- if !target_supports_cranelift_backend ( target) {
1653+ if !CodegenBackendKind :: Cranelift . supports_target ( target) {
16411654 builder. info ( "target not supported by rustc_codegen_cranelift. skipping" ) ;
16421655 return None ;
16431656 }
0 commit comments