Skip to content

Autogenerate unstable compiler flag stubs for unstable-book#157626

Open
kohsine wants to merge 2 commits into
rust-lang:mainfrom
kohsine:autogen-flag-stubs
Open

Autogenerate unstable compiler flag stubs for unstable-book#157626
kohsine wants to merge 2 commits into
rust-lang:mainfrom
kohsine:autogen-flag-stubs

Conversation

@kohsine

@kohsine kohsine commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Closes #141525.

Based on old PR #142135.

Parses rustc -Zhelp to generate doc stubs for unstable compiler flags if any are missing.

@rustbot rustbot 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 8, 2026
@rustbot

rustbot commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

r? @clubby789

rustbot has assigned @clubby789.
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, jieyouxu

@clubby789

Copy link
Copy Markdown
Contributor

For context, a previous attempt at this parsed the options macro: #154070 This was reverted in #154488. Would you be interested in investigating an approach that addresses the concerns raised?

If not, please add a Co-authored-by: credit with the original author of this code to your commit.

@clubby789 clubby789 added the A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools label Jun 9, 2026
@kohsine

kohsine commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

For context, a previous attempt at this parsed the options macro: #154070 This was reverted in #154488. Would you be interested in investigating an approach that addresses the concerns raised?

I can address the concerns in #154488 here:

Moving the unstable options to a separate include! file is marginally more convenient for the unstable-book-gen tool, but a big hassle for compiler contributors looking to read or modify the list of unstable options. It breaks normal file layout conventions, interferes with navigation, and interferes with IDE features, all without ever being truly necessary.

Options file is not touched because it parses rustc -Zhelp instead.

The extra syn-based parser in unstable-book-gen is quite complicated, almost entirely undocumented, and seemingly buggy. That makes it extremely difficult to understand or modify, which in turn makes it effectively impossible to ever change the options! macro on the compiler side.

No external dependencies are used. It's all plain string matching and splitting. Should be fairly easy to modify for anyone looking to change the formatting of rustc -Zhelp.

The new tests in unstable-book-gen don't appear to be hooked up to run in CI.

There are no new tests.

The compiler changes don't appear to have been approved by a T-compiler reviewer.

Should probably link T-compiler since changing rustc -Zhelp output could break unstable-book build if this PR gets merged.

Co-authored-by: Ryan Mehri <52933714+rmehri01@users.noreply.github.com>
@kohsine kohsine force-pushed the autogen-flag-stubs branch from 97b98b5 to d3201bd Compare June 9, 2026 20:42
@kohsine

kohsine commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Added Co-authored-by

@clubby789

Copy link
Copy Markdown
Contributor

I can address the concerns here

I was asking if you'd like to investigate a macro-parsing approach which addresses these concerns. I think this is fine though;
@bors r+

@rust-bors

rust-bors Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

📌 Commit d3201bd has been approved by clubby789

It is now in the queue for this repository.

🌲 The tree is currently closed for pull requests below priority 5. This pull request will be tested once the tree is reopened.

@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 Jun 10, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 10, 2026
…by789

Autogenerate unstable compiler flag stubs for unstable-book

Closes rust-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-bors Bot pushed a commit that referenced this pull request Jun 10, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - #157280 (traits: Allow escaping self types in ExistentialTraitRef::with_self_ty)
 - #157282 (Fix post-monomorphization error note race in the parallel frontend)
 - #157352 (Make the retained dep graph deterministic under the parallel frontend)
 - #157601 (Emit error for unused target expression in glob and list delegations)
 - #157626 (Autogenerate unstable compiler flag stubs for unstable-book)
 - #157647 (Start using comptime for reflection intrinsics and their wrapper functions)
 - #157013 (Ensure inferred let pattern types are well-formed)
 - #157288 (platform support: add SNaN erratum to MIPS targets)
 - #157355 (Add `or_try_*` variants for `HashMap` and `BTreeMap` Entry APIs)
 - #157577 (Fix parser error recovery treating 'dyn' as a strict keyword in Rust …)
 - #157670 (Rename `errors.rs` file to `diagnostics.rs` (4/N))
 - #157691 (Move symbol hiding code to a new file)
 - #157700 (Rename `errors.rs` file to `diagnostics.rs` (5/N))
 - #157703 (Fix doc link to Instant sub in saturating caveat)

Failed merges:

 - #157699 (Arg splat experiment - hir FnDecl impl)
rust-bors Bot pushed a commit that referenced this pull request Jun 10, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - #157280 (traits: Allow escaping self types in ExistentialTraitRef::with_self_ty)
 - #157282 (Fix post-monomorphization error note race in the parallel frontend)
 - #157352 (Make the retained dep graph deterministic under the parallel frontend)
 - #157601 (Emit error for unused target expression in glob and list delegations)
 - #157626 (Autogenerate unstable compiler flag stubs for unstable-book)
 - #157647 (Start using comptime for reflection intrinsics and their wrapper functions)
 - #157013 (Ensure inferred let pattern types are well-formed)
 - #157288 (platform support: add SNaN erratum to MIPS targets)
 - #157355 (Add `or_try_*` variants for `HashMap` and `BTreeMap` Entry APIs)
 - #157577 (Fix parser error recovery treating 'dyn' as a strict keyword in Rust …)
 - #157670 (Rename `errors.rs` file to `diagnostics.rs` (4/N))
 - #157691 (Move symbol hiding code to a new file)
 - #157700 (Rename `errors.rs` file to `diagnostics.rs` (5/N))
 - #157703 (Fix doc link to Instant sub in saturating caveat)

Failed merges:

 - #157699 (Arg splat experiment - hir FnDecl impl)
@JonathanBrouwer

Copy link
Copy Markdown
Contributor

💔 I suspect this PR failed tests as part of a rollup
@bors r-

After fixing the problem, consider running a try job for the failed job before re-approving.

Link to failure: #157708 (comment)

@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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 10, 2026
@rust-bors

rust-bors Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

This PR was contained in a rollup (#157708), which was unapproved.

View changes since this unapproval

@clubby789

Copy link
Copy Markdown
Contributor

no -Z options were found in x86_64-gnu-stable; probably that these options are unavailable in a stable build

@rustbot

This comment was marked as outdated.

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-CI Area: Our Github Actions CI A-compiletest Area: The compiletest test runner A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-run-make Area: port run-make Makefiles to rmake.rs A-rustdoc-js Area: Rustdoc's JS front-end labels Jun 10, 2026
@rustbot rustbot added T-clippy Relevant to the Clippy team. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Jun 10, 2026
@kohsine

kohsine commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

Oh god what I have done

So sorry to everyone coming here wondering why they got pinged. I messed up the rebase and every commit got pushed to this branch.

@kohsine kohsine force-pushed the autogen-flag-stubs branch from 6be901b to d3201bd Compare June 10, 2026 19:49
@kohsine

kohsine commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

Should pass CI on stable now

@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 Jun 10, 2026
@JonathanBrouwer

JonathanBrouwer commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Don't worry these rebase errors happen regularly 😂
@bors try jobs=x86_64-gnu-stable

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jun 10, 2026
Autogenerate unstable compiler flag stubs for unstable-book


try-job: x86_64-gnu-stable
@clubby789 clubby789 removed A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-testsuite Area: The testsuite used to check the correctness of rustc O-windows Operating system: Windows A-attributes Area: Attributes (`#[…]`, `#![…]`) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. O-unix Operating system: Unix-like A-rustdoc-json Area: Rustdoc JSON backend A-rustdoc-js Area: Rustdoc's JS front-end WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) A-CI Area: Our Github Actions CI A-compiletest Area: The compiletest test runner A-run-make Area: port run-make Makefiles to rmake.rs T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue. T-clippy Relevant to the Clippy team. labels Jun 10, 2026
@rust-bors

rust-bors Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 7f60639 (7f60639b302eee795b0813365e6b17c615f9cad5, parent: 485ec3fbcc12fa14ef6596dabb125ad710499c9e)

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

Labels

A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools 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)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

autogenerate compiler flag stubs in the unstable book

4 participants