@@ -494,7 +494,8 @@ macro_rules! tool_check_step {
494
494
// The part of this path after the final '/' is also used as a display name.
495
495
path: $path: literal
496
496
$( , alt_path: $alt_path: literal ) *
497
- , mode: $mode: path
497
+ // Closure that returns `Mode` based on the passed `&Builder<'_>`
498
+ , mode: $mode: expr
498
499
$( , allow_features: $allow_features: expr ) ?
499
500
$( , default : $default: literal ) ?
500
501
$( , ) ?
@@ -518,10 +519,13 @@ macro_rules! tool_check_step {
518
519
519
520
fn make_run( run: RunConfig <' _>) {
520
521
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) ;
522
526
523
527
// 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 {
525
529
println!( "WARNING: not checking bootstrap tool {} for target {target} as it is a bootstrap (host-only) tool" , stringify!( $path) ) ;
526
530
return ;
527
531
} ;
@@ -536,7 +540,8 @@ macro_rules! tool_check_step {
536
540
$( _value = $allow_features; ) ?
537
541
_value
538
542
} ;
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) ;
540
545
}
541
546
542
547
fn metadata( & self ) -> Option <StepMetadata > {
@@ -593,43 +598,47 @@ fn run_tool_check_step(
593
598
tool_check_step ! ( Rustdoc {
594
599
path: "src/tools/rustdoc" ,
595
600
alt_path: "src/librustdoc" ,
596
- mode: Mode :: ToolRustc
601
+ mode: |_builder| Mode :: ToolRustc
597
602
} ) ;
598
603
// Clippy, miri and Rustfmt are hybrids. They are external tools, but use a git subtree instead
599
604
// of a submodule. Since the SourceType only drives the deny-warnings
600
605
// behavior, treat it as in-tree so that any new warnings in clippy will be
601
606
// 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 } ) ;
606
611
tool_check_step ! ( MiroptTestTools {
607
612
path: "src/tools/miropt-test-tools" ,
608
- mode: Mode :: ToolBootstrap
613
+ mode: |_builder| Mode :: ToolBootstrap
609
614
} ) ;
610
615
// We want to test the local std
611
616
tool_check_step ! ( TestFloatParse {
612
617
path: "src/tools/test-float-parse" ,
613
- mode: Mode :: ToolStd ,
618
+ mode: |_builder| Mode :: ToolStd ,
614
619
allow_features: tool:: TestFloatParse :: ALLOW_FEATURES
615
620
} ) ;
616
621
tool_check_step ! ( FeaturesStatusDump {
617
622
path: "src/tools/features-status-dump" ,
618
- mode: Mode :: ToolBootstrap
623
+ mode: |_builder| Mode :: ToolBootstrap
619
624
} ) ;
620
625
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
+ } ) ;
622
631
623
632
// `run-make-support` will be built as part of suitable run-make compiletest test steps, but support
624
633
// check to make it easier to work on.
625
634
tool_check_step ! ( RunMakeSupport {
626
635
path: "src/tools/run-make-support" ,
627
- mode: Mode :: ToolBootstrap ,
636
+ mode: |_builder| Mode :: ToolBootstrap ,
628
637
default : false
629
638
} ) ;
630
639
631
640
tool_check_step ! ( CoverageDump {
632
641
path: "src/tools/coverage-dump" ,
633
- mode: Mode :: ToolBootstrap ,
642
+ mode: |_builder| Mode :: ToolBootstrap ,
634
643
default : false
635
644
} ) ;
0 commit comments