@@ -482,7 +482,8 @@ macro_rules! tool_check_step {
482
482
// The part of this path after the final '/' is also used as a display name.
483
483
path: $path: literal
484
484
$( , alt_path: $alt_path: literal ) *
485
- , mode: $mode: path
485
+ // Closure that returns `Mode` based on the passed `&Builder<'_>`
486
+ , mode: $mode: expr
486
487
$( , allow_features: $allow_features: expr ) ?
487
488
$( , default : $default: literal ) ?
488
489
$( , ) ?
@@ -506,10 +507,13 @@ macro_rules! tool_check_step {
506
507
507
508
fn make_run( run: RunConfig <' _>) {
508
509
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) ;
510
514
511
515
// 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 {
513
517
println!( "WARNING: not checking bootstrap tool {} for target {target} as it is a bootstrap (host-only) tool" , stringify!( $path) ) ;
514
518
return ;
515
519
} ;
@@ -524,7 +528,8 @@ macro_rules! tool_check_step {
524
528
$( _value = $allow_features; ) ?
525
529
_value
526
530
} ;
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) ;
528
533
}
529
534
530
535
fn metadata( & self ) -> Option <StepMetadata > {
@@ -581,43 +586,47 @@ fn run_tool_check_step(
581
586
tool_check_step ! ( Rustdoc {
582
587
path: "src/tools/rustdoc" ,
583
588
alt_path: "src/librustdoc" ,
584
- mode: Mode :: ToolRustc
589
+ mode: |_builder| Mode :: ToolRustc
585
590
} ) ;
586
591
// Clippy, miri and Rustfmt are hybrids. They are external tools, but use a git subtree instead
587
592
// of a submodule. Since the SourceType only drives the deny-warnings
588
593
// behavior, treat it as in-tree so that any new warnings in clippy will be
589
594
// 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 } ) ;
594
599
tool_check_step ! ( MiroptTestTools {
595
600
path: "src/tools/miropt-test-tools" ,
596
- mode: Mode :: ToolBootstrap
601
+ mode: |_builder| Mode :: ToolBootstrap
597
602
} ) ;
598
603
// We want to test the local std
599
604
tool_check_step ! ( TestFloatParse {
600
605
path: "src/tools/test-float-parse" ,
601
- mode: Mode :: ToolStd ,
606
+ mode: |_builder| Mode :: ToolStd ,
602
607
allow_features: tool:: TestFloatParse :: ALLOW_FEATURES
603
608
} ) ;
604
609
tool_check_step ! ( FeaturesStatusDump {
605
610
path: "src/tools/features-status-dump" ,
606
- mode: Mode :: ToolBootstrap
611
+ mode: |_builder| Mode :: ToolBootstrap
607
612
} ) ;
608
613
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
+ } ) ;
610
619
611
620
// `run-make-support` will be built as part of suitable run-make compiletest test steps, but support
612
621
// check to make it easier to work on.
613
622
tool_check_step ! ( RunMakeSupport {
614
623
path: "src/tools/run-make-support" ,
615
- mode: Mode :: ToolBootstrap ,
624
+ mode: |_builder| Mode :: ToolBootstrap ,
616
625
default : false
617
626
} ) ;
618
627
619
628
tool_check_step ! ( CoverageDump {
620
629
path: "src/tools/coverage-dump" ,
621
- mode: Mode :: ToolBootstrap ,
630
+ mode: |_builder| Mode :: ToolBootstrap ,
622
631
default : false
623
632
} ) ;
0 commit comments