Skip to content

Commit 330d54c

Browse files
committed
Use struct-like syntax in tool_check_step!
This tricks rustfmt into formatting the macro arguments as expressions, instead of giving up and ignoring them.
1 parent ae4e1f6 commit 330d54c

File tree

1 file changed

+19
-15
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+19
-15
lines changed

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

+19-15
Original file line numberDiff line numberDiff line change
@@ -401,10 +401,14 @@ impl Step for RustAnalyzer {
401401

402402
macro_rules! tool_check_step {
403403
(
404-
$name:ident,
405-
$path:literal
406-
$(, alt_path: $alt_path:literal )*
407-
$(, default: $default:literal )?
404+
$name:ident {
405+
// The part of this path after the final '/' is also used as a
406+
// display name, and as part of the `-check.stamp` filename.
407+
path: $path:literal
408+
$(, alt_path: $alt_path:literal )*
409+
$(, default: $default:literal )?
410+
$( , )?
411+
}
408412
) => {
409413
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
410414
pub struct $name {
@@ -469,23 +473,23 @@ fn run_tool_check_step(builder: &Builder<'_>, target: TargetSelection, path: &st
469473
run_cargo(builder, cargo, builder.config.free_args.clone(), &stamp, vec![], true, false);
470474
}
471475

472-
tool_check_step!(Rustdoc, "src/tools/rustdoc", alt_path: "src/librustdoc");
476+
tool_check_step!(Rustdoc { path: "src/tools/rustdoc", alt_path: "src/librustdoc" });
473477
// Clippy, miri and Rustfmt are hybrids. They are external tools, but use a git subtree instead
474478
// of a submodule. Since the SourceType only drives the deny-warnings
475479
// behavior, treat it as in-tree so that any new warnings in clippy will be
476480
// rejected.
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);
481+
tool_check_step!(Clippy { path: "src/tools/clippy" });
482+
tool_check_step!(Miri { path: "src/tools/miri" });
483+
tool_check_step!(CargoMiri { path: "src/tools/miri/cargo-miri" });
484+
tool_check_step!(Rls { path: "src/tools/rls" });
485+
tool_check_step!(Rustfmt { path: "src/tools/rustfmt" });
486+
tool_check_step!(MiroptTestTools { path: "src/tools/miropt-test-tools" });
487+
tool_check_step!(TestFloatParse { path: "src/etc/test-float-parse" });
488+
489+
tool_check_step!(Bootstrap { path: "src/bootstrap", default: false });
486490
// Compiletest is implicitly "checked" when it gets built in order to run tests,
487491
// so this is mainly for people working on compiletest to run locally.
488-
tool_check_step!(Compiletest, "src/tools/compiletest", default: false);
492+
tool_check_step!(Compiletest { path: "src/tools/compiletest", default: false });
489493

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

0 commit comments

Comments
 (0)