Skip to content

Commit 774e83c

Browse files
committed
Make tool_check_step! always assume SourceType::InTree
All of the tools that use this macro are currently in-tree, so support for specifying a `SourceType` was not meaningfully used. It can potentially be re-added in the future if needed.
1 parent c59ccae commit 774e83c

File tree

1 file changed

+23
-21
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+23
-21
lines changed

Diff for: src/bootstrap/src/core/build_steps/check.rs

+23-21
Original file line numberDiff line numberDiff line change
@@ -402,10 +402,9 @@ impl Step for RustAnalyzer {
402402
macro_rules! tool_check_step {
403403
(
404404
$name:ident,
405-
$path:literal,
406-
$($alias:literal, )*
407-
$source_type:path
408-
$(, $default:literal )?
405+
$path:literal
406+
$(, alt_path: $alt_path:literal )*
407+
$(, default: $default:literal )?
409408
) => {
410409
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
411410
pub struct $name {
@@ -415,11 +414,11 @@ macro_rules! tool_check_step {
415414
impl Step for $name {
416415
type Output = ();
417416
const ONLY_HOSTS: bool = true;
418-
/// don't ever check out-of-tree tools by default, they'll fail when toolstate is broken
419-
const DEFAULT: bool = matches!($source_type, SourceType::InTree) $( && $default )?;
417+
/// Most of the tool-checks using this macro are run by default.
418+
const DEFAULT: bool = true $( && $default )?;
420419

421420
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
422-
run.paths(&[ $path, $($alias),* ])
421+
run.paths(&[ $path, $( $alt_path ),* ])
423422
}
424423

425424
fn make_run(run: RunConfig<'_>) {
@@ -428,7 +427,7 @@ macro_rules! tool_check_step {
428427

429428
fn run(self, builder: &Builder<'_>) {
430429
let Self { target } = self;
431-
run_tool_check_step(builder, target, stringify!($name), $path, $source_type);
430+
run_tool_check_step(builder, target, stringify!($name), $path);
432431
}
433432
}
434433
}
@@ -440,7 +439,6 @@ fn run_tool_check_step(
440439
target: TargetSelection,
441440
step_type_name: &str,
442441
path: &str,
443-
source_type: SourceType,
444442
) {
445443
let display_name = path.rsplit('/').next().unwrap();
446444
let compiler = builder.compiler(builder.top_stage, builder.config.build);
@@ -454,7 +452,11 @@ fn run_tool_check_step(
454452
target,
455453
builder.kind,
456454
path,
457-
source_type,
455+
// Currently, all of the tools that use this macro/function are in-tree.
456+
// If support for out-of-tree tools is re-added in the future, those
457+
// steps should probably be marked non-default so that the default
458+
// checks aren't affected by toolstate being broken.
459+
SourceType::InTree,
458460
&[],
459461
);
460462

@@ -472,23 +474,23 @@ fn run_tool_check_step(
472474
run_cargo(builder, cargo, builder.config.free_args.clone(), &stamp, vec![], true, false);
473475
}
474476

475-
tool_check_step!(Rustdoc, "src/tools/rustdoc", "src/librustdoc", SourceType::InTree);
477+
tool_check_step!(Rustdoc, "src/tools/rustdoc", alt_path: "src/librustdoc");
476478
// Clippy, miri and Rustfmt are hybrids. They are external tools, but use a git subtree instead
477479
// of a submodule. Since the SourceType only drives the deny-warnings
478480
// behavior, treat it as in-tree so that any new warnings in clippy will be
479481
// rejected.
480-
tool_check_step!(Clippy, "src/tools/clippy", SourceType::InTree);
481-
tool_check_step!(Miri, "src/tools/miri", SourceType::InTree);
482-
tool_check_step!(CargoMiri, "src/tools/miri/cargo-miri", SourceType::InTree);
483-
tool_check_step!(Rls, "src/tools/rls", SourceType::InTree);
484-
tool_check_step!(Rustfmt, "src/tools/rustfmt", SourceType::InTree);
485-
tool_check_step!(MiroptTestTools, "src/tools/miropt-test-tools", SourceType::InTree);
486-
tool_check_step!(TestFloatParse, "src/etc/test-float-parse", SourceType::InTree);
487-
488-
tool_check_step!(Bootstrap, "src/bootstrap", SourceType::InTree, false);
482+
tool_check_step!(Clippy, "src/tools/clippy");
483+
tool_check_step!(Miri, "src/tools/miri");
484+
tool_check_step!(CargoMiri, "src/tools/miri/cargo-miri");
485+
tool_check_step!(Rls, "src/tools/rls");
486+
tool_check_step!(Rustfmt, "src/tools/rustfmt");
487+
tool_check_step!(MiroptTestTools, "src/tools/miropt-test-tools");
488+
tool_check_step!(TestFloatParse, "src/etc/test-float-parse");
489+
490+
tool_check_step!(Bootstrap, "src/bootstrap", default: false);
489491
// Compiletest is implicitly "checked" when it gets built in order to run tests,
490492
// so this is mainly for people working on compiletest to run locally.
491-
tool_check_step!(Compiletest, "src/tools/compiletest", SourceType::InTree, false);
493+
tool_check_step!(Compiletest, "src/tools/compiletest", default: false);
492494

493495
/// Cargo's output path for the standard library in a given stage, compiled
494496
/// by a particular compiler for the specified target.

0 commit comments

Comments
 (0)