Skip to content

Commit cde54ff

Browse files
committed
refactor tool_doc! so that it can accept additional arguments.
Signed-off-by: ozkanonur <[email protected]>
1 parent dff88b2 commit cde54ff

File tree

1 file changed

+41
-9
lines changed

1 file changed

+41
-9
lines changed

src/bootstrap/doc.rs

+41-9
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,15 @@ impl Step for Rustc {
746746
}
747747

748748
macro_rules! tool_doc {
749-
($tool: ident, $should_run: literal, $path: literal, $(rustc_tool = $rustc_tool:literal, )? $(in_tree = $in_tree:literal, )? [$($krate: literal),+ $(,)?] $(,)?) => {
749+
(
750+
$tool: ident,
751+
$should_run: literal,
752+
$path: literal,
753+
$(rustc_tool = $rustc_tool:literal, )?
754+
$(in_tree = $in_tree:literal, )?
755+
[$($extra_arg: literal),+ $(,)?]
756+
$(,)?
757+
) => {
750758
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
751759
pub struct $tool {
752760
target: TargetSelection,
@@ -834,9 +842,9 @@ macro_rules! tool_doc {
834842
cargo.arg("-Zskip-rustdoc-fingerprint");
835843
// Only include compiler crates, no dependencies of those, such as `libc`.
836844
cargo.arg("--no-deps");
837-
cargo.arg("--lib");
845+
838846
$(
839-
cargo.arg("-p").arg($krate);
847+
cargo.arg($extra_arg);
840848
)+
841849

842850
cargo.rustdocflag("--document-private-items");
@@ -852,41 +860,65 @@ macro_rules! tool_doc {
852860
}
853861
}
854862

855-
tool_doc!(Rustdoc, "rustdoc-tool", "src/tools/rustdoc", ["rustdoc", "rustdoc-json-types"],);
863+
tool_doc!(
864+
Rustdoc,
865+
"rustdoc-tool",
866+
"src/tools/rustdoc",
867+
["-p", "rustdoc", "-p", "rustdoc-json-types"]
868+
);
856869
tool_doc!(
857870
Rustfmt,
858871
"rustfmt-nightly",
859872
"src/tools/rustfmt",
860-
["rustfmt-nightly", "rustfmt-config_proc_macro"],
873+
["-p", "rustfmt-nightly", "-p", "rustfmt-config_proc_macro"],
861874
);
862-
tool_doc!(Clippy, "clippy", "src/tools/clippy", ["clippy_utils"]);
863-
tool_doc!(Miri, "miri", "src/tools/miri", ["miri"]);
875+
tool_doc!(Clippy, "clippy", "src/tools/clippy", ["-p", "clippy_utils"]);
876+
tool_doc!(Miri, "miri", "src/tools/miri", ["-p", "miri"]);
864877
tool_doc!(
865878
Cargo,
866879
"cargo",
867880
"src/tools/cargo",
868881
rustc_tool = false,
869882
in_tree = false,
870883
[
884+
"-p",
871885
"cargo",
886+
"-p",
872887
"cargo-platform",
888+
"-p",
873889
"cargo-util",
890+
"-p",
874891
"crates-io",
892+
"-p",
875893
"cargo-test-macro",
894+
"-p",
876895
"cargo-test-support",
896+
"-p",
877897
"cargo-credential",
898+
"-p",
878899
"cargo-credential-1password",
900+
"-p",
879901
"mdman",
880902
// FIXME: this trips a license check in tidy.
903+
// "-p",
881904
// "resolver-tests",
882905
// FIXME: we should probably document these, but they're different per-platform so we can't use `tool_doc`.
906+
// "-p",
883907
// "cargo-credential-gnome-secret",
908+
// "-p",
884909
// "cargo-credential-macos-keychain",
910+
// "-p",
885911
// "cargo-credential-wincred",
886912
]
887913
);
888-
tool_doc!(Tidy, "tidy", "src/tools/tidy", rustc_tool = false, ["tidy"]);
889-
tool_doc!(Bootstrap, "bootstrap", "src/bootstrap", rustc_tool = false, ["bootstrap"]);
914+
tool_doc!(Tidy, "tidy", "src/tools/tidy", rustc_tool = false, ["-p", "tidy"]);
915+
tool_doc!(
916+
Bootstrap,
917+
"bootstrap",
918+
"src/bootstrap",
919+
rustc_tool = false,
920+
["--lib", "-p", "bootstrap"]
921+
);
890922

891923
#[derive(Ord, PartialOrd, Debug, Copy, Clone, Hash, PartialEq, Eq)]
892924
pub struct ErrorIndex {

0 commit comments

Comments
 (0)