Skip to content

bootstrap: Include feature-gated items in bootstrap tool docs - #161900

Open
Zalathar wants to merge 3 commits into
rust-lang:mainfrom
Zalathar:tool-doc
Open

bootstrap: Include feature-gated items in bootstrap tool docs#161900
Zalathar wants to merge 3 commits into
rust-lang:mainfrom
Zalathar:tool-doc

Conversation

@Zalathar

@Zalathar Zalathar commented Aug 28, 2026

Copy link
Copy Markdown
Member

View all comments

I noticed that the nightly-rustc docs for build_helper don't include the metrics module, because it's gated behind the non-default feature flag feature = "metrics".

This PR fixes that by using --all-features to document all features, and enabling rustdoc's #![feature(doc_cfg)] (via -Zcrate-attr) so that rustdoc will indicate which items require feature flags.

The first two commits are a general cleanup of tool_doc! to pull almost all of its non-trivial code out of the macro and into regular functions.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 28, 2026
@rustbot rustbot added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Aug 28, 2026
@rustbot

rustbot commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: bootstrap
  • bootstrap expanded to 6 candidates
  • Random selection from Mark-Simulacrum, clubby789

@Zalathar

Copy link
Copy Markdown
Member Author

As a follow-up we could also enable this for compiler crates, since a few of them have feature flags to enable nightly-only features when they aren't being used by rust-analyzer.

@Zalathar

Copy link
Copy Markdown
Member Author

I would also like to note that this would have been much more annoying without -Zcrate-attr.

@rust-log-analyzer

This comment has been minimized.

@Zalathar

Copy link
Copy Markdown
Member Author

I really want to blanket allow clippy::too_many_arguments and clippy::type_complexity across all of bootstrap, but I won't do that in this PR.

@Kobzol

Kobzol commented Aug 28, 2026

Copy link
Copy Markdown
Member

r? kobzol

Note that this will conflict a lot with #161716. In general I'm happy to see most of the code move out of a macro.

@rustbot rustbot assigned Kobzol and unassigned Mark-Simulacrum Aug 28, 2026
@Kobzol

Kobzol commented Aug 28, 2026

Copy link
Copy Markdown
Member

Aside: do you find the build_helper/bootstrap docs being present in the nightly rustc docs useful?

@Zalathar

Copy link
Copy Markdown
Member Author

Aside: do you find the build_helper/bootstrap docs being present in the nightly rustc docs useful?

I use the nightly-rustc docs intermittently, but when I do reach for them it's nice to have everything there in one place, especially when I'm not at a computer and can't easily search the source.

@Zalathar

Copy link
Copy Markdown
Member Author

Note that this will conflict a lot with #161716. In general I'm happy to see most of the code move out of a macro.

If conflicts are a concern, I can potentially cut this PR down to just the main fix (within the macro), and defer the macro-extraction to follow-up work.

(I had to do the extraction to work on the fix, but now that I have the fix it should be easy to backport to main.)

@Kobzol

Kobzol commented Aug 28, 2026

Copy link
Copy Markdown
Member

I'd perhaps either do that, or wait for the other PR to get merged, yeah.

@Zalathar

Zalathar commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

@rustbot blocked (on #161716 to avoid conflicts)

@rustbot rustbot added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 2, 2026
@rust-bors

This comment has been minimized.

@rustbot

This comment has been minimized.

@Zalathar

Zalathar commented Sep 4, 2026

Copy link
Copy Markdown
Member Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-blocked Status: Blocked on something else such as an RFC or other implementation work. labels Sep 4, 2026
@Kobzol

Kobzol commented Sep 4, 2026

Copy link
Copy Markdown
Member

Looks good, thanks! Feel free to r=me once PR CI is green.

@Zalathar

Zalathar commented Sep 4, 2026

Copy link
Copy Markdown
Member Author

PR CI is green.

@bors r=Kobzol

@rust-bors

rust-bors Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 8f1843d has been approved by Kobzol

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 4, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Sep 5, 2026
bootstrap: Include feature-gated items in bootstrap tool docs


try-job: dist-x86_64-linux-alt
@rust-bors

rust-bors Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 3ec43f9 failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

@rustbot

rustbot commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@Zalathar

Zalathar commented Sep 5, 2026

Copy link
Copy Markdown
Member Author

Since CI has been weird today, let's run the try job again, after a fresh rebase.

@bors try jobs=dist-x86_64-linux-alt

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Sep 5, 2026
bootstrap: Include feature-gated items in bootstrap tool docs


try-job: dist-x86_64-linux-alt
@rust-bors

rust-bors Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

💔 Test for c4394bd failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

@Zalathar

Zalathar commented Sep 5, 2026

Copy link
Copy Markdown
Member Author

I can reproduce the failure locally, so it's a real failure.

It seems to be triggered by the added cargo.arg("--all-features"). So perhaps there's some non-default rustfmt feature that is doing weird things.

A major advantage of struct syntax in macros is that rustfmt will auto-format
the macro invocations.
@Zalathar

Zalathar commented Sep 5, 2026

Copy link
Copy Markdown
Member Author

In order to fix the rustfmt doc failures, I added a flag to selectively disable --all-features for a particular tool.

As a prerequisite to that, I also did a general cleanup of the syntax used by tool_doc!, because the current syntax is confusingly inconsistent.

@bors try jobs=dist-x86_64-linux-alt
@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 5, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Sep 5, 2026
bootstrap: Include feature-gated items in bootstrap tool docs


try-job: dist-x86_64-linux-alt
@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 5, 2026
@rust-bors

rust-bors Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

💔 Test for f1cd7dd failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

This sets `--all-features` when documenting bootstrap tool crates, and enables
rustdoc's `#![feature(doc_cfg)]` to display which items are feature-gated.
@Zalathar

Zalathar commented Sep 5, 2026

Copy link
Copy Markdown
Member Author

Looks like Miri is also having trouble. Let's keep excluding tools until we find a configuration that works.

@bors try jobs=dist-x86_64-linux-alt

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Sep 5, 2026
bootstrap: Include feature-gated items in bootstrap tool docs


try-job: dist-x86_64-linux-alt
@rust-bors

rust-bors Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 61661af (61661af10956e3a8709378e2fe4c88a1a1568c0d)
Base parent: 0ed41eb (0ed41eb4142dda2df61eb1145a312c1a9d62eb56)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants