Skip to content

Commit ae4e1f6

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 out-of-tree tool checks was unused. It can potentially be re-added in the future if needed.
1 parent 08551cc commit ae4e1f6

File tree

1 file changed

+24
-26
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+24
-26
lines changed

src/bootstrap/src/core/build_steps/check.rs

+24-26
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,19 +427,14 @@ macro_rules! tool_check_step {
428427

429428
fn run(self, builder: &Builder<'_>) {
430429
let Self { target } = self;
431-
run_tool_check_step(builder, target, $path, $source_type);
430+
run_tool_check_step(builder, target, $path);
432431
}
433432
}
434433
}
435434
}
436435

437436
/// Used by the implementation of `Step::run` in `tool_check_step!`.
438-
fn run_tool_check_step(
439-
builder: &Builder<'_>,
440-
target: TargetSelection,
441-
path: &str,
442-
source_type: SourceType,
443-
) {
437+
fn run_tool_check_step(builder: &Builder<'_>, target: TargetSelection, path: &str) {
444438
let display_name = path.rsplit('/').next().unwrap();
445439
let compiler = builder.compiler(builder.top_stage, builder.config.build);
446440

@@ -453,7 +447,11 @@ fn run_tool_check_step(
453447
target,
454448
builder.kind,
455449
path,
456-
source_type,
450+
// Currently, all of the tools that use this macro/function are in-tree.
451+
// If support for out-of-tree tools is re-added in the future, those
452+
// steps should probably be marked non-default so that the default
453+
// checks aren't affected by toolstate being broken.
454+
SourceType::InTree,
457455
&[],
458456
);
459457

@@ -471,23 +469,23 @@ fn run_tool_check_step(
471469
run_cargo(builder, cargo, builder.config.free_args.clone(), &stamp, vec![], true, false);
472470
}
473471

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

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

0 commit comments

Comments
 (0)