@@ -482,7 +482,8 @@ macro_rules! tool_check_step {
482482 // The part of this path after the final '/' is also used as a display name.
483483 path: $path: literal
484484 $( , alt_path: $alt_path: literal ) *
485- , mode: $mode: path
485+ // Closure that returns `Mode` based on the passed `&Builder<'_>`
486+ , mode: $mode: expr
486487 $( , allow_features: $allow_features: expr ) ?
487488 $( , default : $default: literal ) ?
488489 $( , ) ?
@@ -506,10 +507,13 @@ macro_rules! tool_check_step {
506507
507508 fn make_run( run: RunConfig <' _>) {
508509 let target = run. target;
509- let build_compiler = prepare_compiler_for_check( run. builder, target, $mode) ;
510+ let builder = run. builder;
511+ let mode = $mode( builder) ;
512+
513+ let build_compiler = prepare_compiler_for_check( run. builder, target, mode) ;
510514
511515 // It doesn't make sense to cross-check bootstrap tools
512- if $ mode == Mode :: ToolBootstrap && target != run. builder. host_target {
516+ if mode == Mode :: ToolBootstrap && target != run. builder. host_target {
513517 println!( "WARNING: not checking bootstrap tool {} for target {target} as it is a bootstrap (host-only) tool" , stringify!( $path) ) ;
514518 return ;
515519 } ;
@@ -524,7 +528,8 @@ macro_rules! tool_check_step {
524528 $( _value = $allow_features; ) ?
525529 _value
526530 } ;
527- run_tool_check_step( builder, build_compiler, target, $path, $mode, allow_features) ;
531+ let mode = $mode( builder) ;
532+ run_tool_check_step( builder, build_compiler, target, $path, mode, allow_features) ;
528533 }
529534
530535 fn metadata( & self ) -> Option <StepMetadata > {
@@ -581,43 +586,47 @@ fn run_tool_check_step(
581586tool_check_step ! ( Rustdoc {
582587 path: "src/tools/rustdoc" ,
583588 alt_path: "src/librustdoc" ,
584- mode: Mode :: ToolRustc
589+ mode: |_builder| Mode :: ToolRustc
585590} ) ;
586591// Clippy, miri and Rustfmt are hybrids. They are external tools, but use a git subtree instead
587592// of a submodule. Since the SourceType only drives the deny-warnings
588593// behavior, treat it as in-tree so that any new warnings in clippy will be
589594// rejected.
590- tool_check_step ! ( Clippy { path: "src/tools/clippy" , mode: Mode :: ToolRustc } ) ;
591- tool_check_step ! ( Miri { path: "src/tools/miri" , mode: Mode :: ToolRustc } ) ;
592- tool_check_step ! ( CargoMiri { path: "src/tools/miri/cargo-miri" , mode: Mode :: ToolRustc } ) ;
593- tool_check_step ! ( Rustfmt { path: "src/tools/rustfmt" , mode: Mode :: ToolRustc } ) ;
595+ tool_check_step ! ( Clippy { path: "src/tools/clippy" , mode: |_builder| Mode :: ToolRustc } ) ;
596+ tool_check_step ! ( Miri { path: "src/tools/miri" , mode: |_builder| Mode :: ToolRustc } ) ;
597+ tool_check_step ! ( CargoMiri { path: "src/tools/miri/cargo-miri" , mode: |_builder| Mode :: ToolRustc } ) ;
598+ tool_check_step ! ( Rustfmt { path: "src/tools/rustfmt" , mode: |_builder| Mode :: ToolRustc } ) ;
594599tool_check_step ! ( MiroptTestTools {
595600 path: "src/tools/miropt-test-tools" ,
596- mode: Mode :: ToolBootstrap
601+ mode: |_builder| Mode :: ToolBootstrap
597602} ) ;
598603// We want to test the local std
599604tool_check_step ! ( TestFloatParse {
600605 path: "src/tools/test-float-parse" ,
601- mode: Mode :: ToolStd ,
606+ mode: |_builder| Mode :: ToolStd ,
602607 allow_features: tool:: TestFloatParse :: ALLOW_FEATURES
603608} ) ;
604609tool_check_step ! ( FeaturesStatusDump {
605610 path: "src/tools/features-status-dump" ,
606- mode: Mode :: ToolBootstrap
611+ mode: |_builder| Mode :: ToolBootstrap
607612} ) ;
608613
609- tool_check_step ! ( Bootstrap { path: "src/bootstrap" , mode: Mode :: ToolBootstrap , default : false } ) ;
614+ tool_check_step ! ( Bootstrap {
615+ path: "src/bootstrap" ,
616+ mode: |_builder| Mode :: ToolBootstrap ,
617+ default : false
618+ } ) ;
610619
611620// `run-make-support` will be built as part of suitable run-make compiletest test steps, but support
612621// check to make it easier to work on.
613622tool_check_step ! ( RunMakeSupport {
614623 path: "src/tools/run-make-support" ,
615- mode: Mode :: ToolBootstrap ,
624+ mode: |_builder| Mode :: ToolBootstrap ,
616625 default : false
617626} ) ;
618627
619628tool_check_step ! ( CoverageDump {
620629 path: "src/tools/coverage-dump" ,
621- mode: Mode :: ToolBootstrap ,
630+ mode: |_builder| Mode :: ToolBootstrap ,
622631 default : false
623632} ) ;
0 commit comments