Skip to content

docs: autogenerate compiler flag stubs based on -Zhelp - #142135

Closed
rmehri01 wants to merge 2 commits into
rust-lang:masterfrom
rmehri01:gen-compiler-flags
Closed

docs: autogenerate compiler flag stubs based on -Zhelp#142135
rmehri01 wants to merge 2 commits into
rust-lang:masterfrom
rmehri01:gen-compiler-flags

Conversation

@rmehri01

@rmehri01rmehri01 commented Jun 7, 2025

Copy link
Copy Markdown
Contributor

Adds autogenerated compiler flag stubs to the unstable book by building rustc, passing it's path to unstable-book-gen, and using that to call the compiler with -Zhelp and create a similar Features that is used for library and lang stubs.

Example:

# `combine_cgu`
combine CGUs into a single one
This feature has no tracking issue, and is therefore likely internal to the compiler, not being intended for general use.
------------------------

Closes#141525

@rustbot

Copy link
Copy Markdown
Collaborator

Failed to set assignee to jyn514: invalid assignee

Note: Only org members with at least the repository "read" role, users with write permissions, or people who have commented on the PR may be assigned.

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

Copy link
Copy Markdown
Collaborator

Error: Parsing assign command in comment failed: ...'' | error: specify user to assign to at >| ''...

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #t-infra on Zulip.

@workingjubilee

Copy link
Copy Markdown
Member

r? compiler

@rustbotrustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 7, 2025
@rust-log-analyzer

This comment has been minimized.

@rmehri01
rmehri01force-pushed the gen-compiler-flags branch from 42a4c2d to 2cfd494CompareJune 7, 2025 02:26
@lcnr

lcnr commented Jun 10, 2025

Copy link
Copy Markdown
Contributor

r? compiler

@rustbotrustbot assigned compiler-errors and unassigned lcnrJun 10, 2025
@compiler-errors

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Jun 11, 2025

Copy link
Copy Markdown
Collaborator

📌 Commit 2cfd494 has been approved by compiler-errors

It is now in the queue for this repository.

@borsbors 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 Jun 11, 2025
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Jun 12, 2025
…piler-errors
docs: autogenerate compiler flag stubs based on -Zhelp
Adds autogenerated compiler flag stubs to the unstable book by building rustc, passing it's path to `unstable-book-gen`, and using that to call the compiler with `-Zhelp` and create a similar `Features` that is used for library and lang stubs.
Example:
```md
# `combine_cgu`
combine CGUs into a single one
This feature has no tracking issue, and is therefore likely internal to the compiler, not being intended for general use.
------------------------
```
Closesrust-lang#141525
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Jun 12, 2025
…piler-errors
docs: autogenerate compiler flag stubs based on -Zhelp
Adds autogenerated compiler flag stubs to the unstable book by building rustc, passing it's path to `unstable-book-gen`, and using that to call the compiler with `-Zhelp` and create a similar `Features` that is used for library and lang stubs.
Example:
```md
# `combine_cgu`
combine CGUs into a single one
This feature has no tracking issue, and is therefore likely internal to the compiler, not being intended for general use.
------------------------
```
Closesrust-lang#141525
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 12, 2025
…piler-errors
docs: autogenerate compiler flag stubs based on -Zhelp
Adds autogenerated compiler flag stubs to the unstable book by building rustc, passing it's path to `unstable-book-gen`, and using that to call the compiler with `-Zhelp` and create a similar `Features` that is used for library and lang stubs.
Example:
```md
# `combine_cgu`
combine CGUs into a single one
This feature has no tracking issue, and is therefore likely internal to the compiler, not being intended for general use.
------------------------
```
Closesrust-lang#141525
bors added a commit that referenced this pull request Jun 12, 2025
Rollup of 9 pull requests
Successful merges:
- #138016 (Added `Clone` implementation for `ChunkBy`)
- #140770 (add `extern "custom"` functions)
- #141162 (refactor `AttributeGate` and `rustc_attr!` to emit notes during feature checking)
- #141474 (Add `ParseMode::Diagnostic` and fix multiline spans in diagnostic attribute lints)
- #141947 (Specify that "option-like" enums must be `#[repr(Rust)]` to be ABI-compatible with their non-1ZST field.)
- #142135 (docs: autogenerate compiler flag stubs based on -Zhelp)
- #142252 (Improve clarity of `core::sync::atomic` docs about "Considerations" in regards to CAS operations)
- #142337 (miri: add flag to suppress float non-determinism)
- #142353 (compiler: Ease off the accelerator on `unsupported_calling_conventions`)
r? `@ghost`
`@rustbot` modify labels: rollup
@matthiaskrgr

Copy link
Copy Markdown
Member

@bors r-
guess this failed here #142399 (comment)

@borsbors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 12, 2025
@alex-semenyuk

Copy link
Copy Markdown
Member

@rmehri01
Thanks for your contribution.
Form wg-triage. Any updates on this PR?

@rmehri01

rmehri01 commented Aug 9, 2025

Copy link
Copy Markdown
ContributorAuthor

@rmehri01 Thanks for your contribution. Form wg-triage. Any updates on this PR?

Hey! Sorry I'm not exactly sure what went wrong here, it seems like it has to do something with getting the output of -Zhelp on aarch64 windows, is there something else we should try instead?

Edit: nvm I think I messed up the host argument to builder.compiler

@rustbot

This comment has been minimized.

@rustbotrustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 9, 2025
@bors

bors commented Aug 10, 2025

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #145210) made this pull request unmergeable. Please resolve the merge conflicts.

@rust-log-analyzer

This comment has been minimized.

@rmehri01
rmehri01force-pushed the gen-compiler-flags branch 2 times, most recently from d633a45 to 91ee21bCompareAugust 10, 2025 19:42
@bors

bors commented Aug 11, 2025

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #145011) made this pull request unmergeable. Please resolve the merge conflicts.

@compiler-errors

Copy link
Copy Markdown
Contributor

r? bootstrap

Comment threadsrc/bootstrap/src/core/build_steps/doc.rs Outdated
Comment threadsrc/bootstrap/src/core/build_steps/doc.rs Outdated

fn collect_compiler_flags(rustc_path: impl AsRef<Path>) -> Features {
let mut rustc = Command::new(rustc_path.as_ref());
rustc.arg("-Zhelp");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than running -Zhelp and then trying to parse that, maybe we can parse the options! macro (

)? I think that has all the -Z flags. That would also give you a file/line to link to. I'm not sure how valuable that is, but if it is, that seems like the way to get that information.

I'm OK with sticking with -Z/-C parsing since the syntax is both fairly simple and controlled by us, though.

We'd likely also want (perhaps in a separate PR) to enforce that all the -C flags in codegen options (also in the linked file) have documentation in the non-unstable book. That could be done in tidy.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would probably be nice to have the file/line to link to, do you mean just literally reading and parsing the rust source file to do that or is there a better way to go about it?

@Mark-SimulacrumMark-Simulacrum 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 Aug 21, 2025
@bors

bors commented Sep 21, 2025

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #146592) made this pull request unmergeable. Please resolve the merge conflicts.

@rustbotrustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Oct 11, 2025
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 10, 2026
…by789
Autogenerate unstable compiler flag stubs for unstable-book
Closesrust-lang#141525.
Based on old PR rust-lang#142135.
Parses `rustc -Zhelp` to generate doc stubs for unstable compiler flags if any are missing.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 11, 2026
…by789
Autogenerate unstable compiler flag stubs for unstable-book
Closesrust-lang#141525.
Based on old PR rust-lang#142135.
Parses `rustc -Zhelp` to generate doc stubs for unstable compiler flags if any are missing.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 11, 2026
…by789
Autogenerate unstable compiler flag stubs for unstable-book
Closesrust-lang#141525.
Based on old PR rust-lang#142135.
Parses `rustc -Zhelp` to generate doc stubs for unstable compiler flags if any are missing.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 11, 2026
…by789
Autogenerate unstable compiler flag stubs for unstable-book
Closesrust-lang#141525.
Based on old PR rust-lang#142135.
Parses `rustc -Zhelp` to generate doc stubs for unstable compiler flags if any are missing.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 11, 2026
…by789
Autogenerate unstable compiler flag stubs for unstable-book
Closesrust-lang#141525.
Based on old PR rust-lang#142135.
Parses `rustc -Zhelp` to generate doc stubs for unstable compiler flags if any are missing.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 11, 2026
…by789
Autogenerate unstable compiler flag stubs for unstable-book
Closesrust-lang#141525.
Based on old PR rust-lang#142135.
Parses `rustc -Zhelp` to generate doc stubs for unstable compiler flags if any are missing.
jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 12, 2026
…by789
Autogenerate unstable compiler flag stubs for unstable-book
Closesrust-lang#141525.
Based on old PR rust-lang#142135.
Parses `rustc -Zhelp` to generate doc stubs for unstable compiler flags if any are missing.
rust-timer added a commit that referenced this pull request Jun 12, 2026
Rollup merge of #157626 - kohsine:autogen-flag-stubs, r=clubby789
Autogenerate unstable compiler flag stubs for unstable-book
Closes#141525.
Based on old PR #142135.
Parses `rustc -Zhelp` to generate doc stubs for unstable compiler flags if any are missing.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

autogenerate compiler flag stubs in the unstable book

11 participants

@rmehri01@rustbot@workingjubilee@rust-log-analyzer@lcnr@compiler-errors@bors@matthiaskrgr@alex-semenyuk@Kobzol@Mark-Simulacrum