@@ -494,7 +494,8 @@ macro_rules! tool_check_step {
494494 // The part of this path after the final '/' is also used as a display name.
495495 path: $path: literal
496496 $( , alt_path: $alt_path: literal ) *
497- , mode: $mode: path
497+ // Closure that returns `Mode` based on the passed `&Builder<'_>`
498+ , mode: $mode: expr
498499 $( , allow_features: $allow_features: expr ) ?
499500 $( , default : $default: literal ) ?
500501 $( , ) ?
@@ -518,10 +519,13 @@ macro_rules! tool_check_step {
518519
519520 fn make_run( run: RunConfig <' _>) {
520521 let target = run. target;
521- let build_compiler = prepare_compiler_for_check( run. builder, target, $mode) ;
522+ let builder = run. builder;
523+ let mode = $mode( builder) ;
524+
525+ let build_compiler = prepare_compiler_for_check( run. builder, target, mode) ;
522526
523527 // It doesn't make sense to cross-check bootstrap tools
524- if $ mode == Mode :: ToolBootstrap && target != run. builder. host_target {
528+ if mode == Mode :: ToolBootstrap && target != run. builder. host_target {
525529 println!( "WARNING: not checking bootstrap tool {} for target {target} as it is a bootstrap (host-only) tool" , stringify!( $path) ) ;
526530 return ;
527531 } ;
@@ -536,7 +540,8 @@ macro_rules! tool_check_step {
536540 $( _value = $allow_features; ) ?
537541 _value
538542 } ;
539- run_tool_check_step( builder, build_compiler, target, $path, $mode, allow_features) ;
543+ let mode = $mode( builder) ;
544+ run_tool_check_step( builder, build_compiler, target, $path, mode, allow_features) ;
540545 }
541546
542547 fn metadata( & self ) -> Option <StepMetadata > {
@@ -593,43 +598,47 @@ fn run_tool_check_step(
593598tool_check_step ! ( Rustdoc {
594599 path: "src/tools/rustdoc" ,
595600 alt_path: "src/librustdoc" ,
596- mode: Mode :: ToolRustc
601+ mode: |_builder| Mode :: ToolRustc
597602} ) ;
598603// Clippy, miri and Rustfmt are hybrids. They are external tools, but use a git subtree instead
599604// of a submodule. Since the SourceType only drives the deny-warnings
600605// behavior, treat it as in-tree so that any new warnings in clippy will be
601606// rejected.
602- tool_check_step ! ( Clippy { path: "src/tools/clippy" , mode: Mode :: ToolRustc } ) ;
603- tool_check_step ! ( Miri { path: "src/tools/miri" , mode: Mode :: ToolRustc } ) ;
604- tool_check_step ! ( CargoMiri { path: "src/tools/miri/cargo-miri" , mode: Mode :: ToolRustc } ) ;
605- tool_check_step ! ( Rustfmt { path: "src/tools/rustfmt" , mode: Mode :: ToolRustc } ) ;
607+ tool_check_step ! ( Clippy { path: "src/tools/clippy" , mode: |_builder| Mode :: ToolRustc } ) ;
608+ tool_check_step ! ( Miri { path: "src/tools/miri" , mode: |_builder| Mode :: ToolRustc } ) ;
609+ tool_check_step ! ( CargoMiri { path: "src/tools/miri/cargo-miri" , mode: |_builder| Mode :: ToolRustc } ) ;
610+ tool_check_step ! ( Rustfmt { path: "src/tools/rustfmt" , mode: |_builder| Mode :: ToolRustc } ) ;
606611tool_check_step ! ( MiroptTestTools {
607612 path: "src/tools/miropt-test-tools" ,
608- mode: Mode :: ToolBootstrap
613+ mode: |_builder| Mode :: ToolBootstrap
609614} ) ;
610615// We want to test the local std
611616tool_check_step ! ( TestFloatParse {
612617 path: "src/tools/test-float-parse" ,
613- mode: Mode :: ToolStd ,
618+ mode: |_builder| Mode :: ToolStd ,
614619 allow_features: tool:: TestFloatParse :: ALLOW_FEATURES
615620} ) ;
616621tool_check_step ! ( FeaturesStatusDump {
617622 path: "src/tools/features-status-dump" ,
618- mode: Mode :: ToolBootstrap
623+ mode: |_builder| Mode :: ToolBootstrap
619624} ) ;
620625
621- tool_check_step ! ( Bootstrap { path: "src/bootstrap" , mode: Mode :: ToolBootstrap , default : false } ) ;
626+ tool_check_step ! ( Bootstrap {
627+ path: "src/bootstrap" ,
628+ mode: |_builder| Mode :: ToolBootstrap ,
629+ default : false
630+ } ) ;
622631
623632// `run-make-support` will be built as part of suitable run-make compiletest test steps, but support
624633// check to make it easier to work on.
625634tool_check_step ! ( RunMakeSupport {
626635 path: "src/tools/run-make-support" ,
627- mode: Mode :: ToolBootstrap ,
636+ mode: |_builder| Mode :: ToolBootstrap ,
628637 default : false
629638} ) ;
630639
631640tool_check_step ! ( CoverageDump {
632641 path: "src/tools/coverage-dump" ,
633- mode: Mode :: ToolBootstrap ,
642+ mode: |_builder| Mode :: ToolBootstrap ,
634643 default : false
635644} ) ;
0 commit comments