-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Automate rustc(1) man page generation using help2man script
#150066
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Generate the rustc.1 man page from `rustc --help -v` using help2man to ensure the documentation stays in sync with the compiler’s actual CLI behavior. The generation logic lives in src/doc/man and writes rustc.1 to the same directory, independent of the current working directory.
- Introduce `src/doc/man/generate-rustc-man.sh`, a robust script that generates the `rustc(1)` man page entirely from the current built binary’s `--help -v` output using help2man. - Add `README.md` in the same directory to document the rationale, instructions, and prerequisites for this process. - Ensures the man page always reflects the actual compiler behavior, avoids manual edits or duplication, and is easy to update as CLI options evolve.
|
rustbot has assigned @GuillaumeGomez. Use |
|
Not too sure who's supposed to review this. r? compiler |
|
I’m a bit unsure how to route and review this change, since it was redirected to a compiler team. As far as I understand it introduces new documentation-generation tooling and touches on how the rustc(1) man page is produced, and it’s not clear to me which team should be reviewing this or how it fits into our existing documentation processes Could you clarify:
That would help figure out how (and by whom) this should be discussed further |
|
I noticed two different issues(#149875 and #98977) that mentioned the I apologize for not linking the issues initially, that may have made it more clear. |
|
@Kivooeo i’m willing to review this if you can’t find a reviewer. i don’t have r+ permissions anymore though. |
Yeah, that's sounds really nice, thanks for taking time on it also if you know, because I don't if we have to cooperate this with our release or infra teams to integrate this into our release process, like generate man before/with new release or only after editing cli flags, you might know this better
Also not a problem Do "r=me,jyn514" after approval, I'd only ask to be impartial as you can (for example README here is obviously written by ai, I'd prefer to see something more human if you share this. If it's important to clarify, I'm not writing this to criticize the author, but rather as something that could be improved, nothing personal) r? jyn514 |
|
|
|
@bors delegate=jyn514 |
Summary
This PR introduces a reproducible and automated process for generating the
rustc(1)man page directly from the compiler’s help output, ensuring it always reflects the current CLI.Details
Adds
src/doc/man/generate-rustc-man.sh:A shell script that invokes
help2manon any givenrustcbinary, via that binary’s--help -voutput.src/doc/man/rustc.1Documentation in
src/doc/man/README.md:Rationale
The man page is generated entirely from the compiler’s current help text, eliminating drift between documentation and reality.
The script ensures anyone can regenerate the man page exactly, as long as they have a target compiler binary and help2man installed.
By keeping the script and artifacts local to
src/doc/man, there’s no need to depend on build system internals.Usage
After building
rustc, simply run:help2manon the host system (apt install help2man,dnf install help2man, etc).Notes
Ready for feedback or further suggestions!