Skip to content
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

rustc --help does not show all available flags of rustc --print #137853

Closed
kanarus opened this issue Mar 1, 2025 · 3 comments · Fixed by #137862
Closed

rustc --help does not show all available flags of rustc --print #137853

kanarus opened this issue Mar 1, 2025 · 3 comments · Fixed by #137862
Labels
A-CLI Area: Command-line interface (CLI) to the compiler A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@kanarus
Copy link

kanarus commented Mar 1, 2025

rustc --print with an invalid name, for example, x, shows:

error: unknown print request: `x`
  |
  = help: valid print requests are: `all-target-specs-json`, `calling-conventions`, `cfg`, `check-cfg`, `code-models`, `crate-name`, `deployment-target`, `file-names`, `host-tuple`, `link-args`, `native-static-libs`, `relocation-models`, `split-debuginfo`, `stack-protector-strategies`, `sysroot`, `target-cpus`, `target-features`, `target-libdir`, `target-list`, `target-spec-json`, `tls-models`

This seems correct, but rustc --help's description of --print is:

        --print [crate-name|file-names|sysroot|target-libdir|cfg|check-cfg|calling-conventions|target-list|target-cpus|target-features|relocation-models|code-models|tls-models|target-spec-json|all-target-specs-json|native-static-libs|stack-protector-strategies|link-args|deployment-target]
                        Compiler information to print on stdout

This list does not contain

  • host-tuple
  • split-debuginfo

Maybe related

Meta

rustc --version --verbose:

rustc 1.87.0-nightly (794c12416 2025-02-21)
binary: rustc
commit-hash: 794c12416b2138064af1f2746646973fafd9419d
commit-date: 2025-02-21
host: x86_64-unknown-linux-gnu
release: 1.87.0-nightly
LLVM version: 20.1.0
@kanarus kanarus added the C-bug Category: This is a bug. label Mar 1, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 1, 2025
@kanarus kanarus changed the title rustc --help doesn not show all available flags of rustc --print rustc --help does not show all available flags of rustc --print Mar 1, 2025
@jieyouxu jieyouxu added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-CLI Area: Command-line interface (CLI) to the compiler E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. labels Mar 1, 2025
@jieyouxu
Copy link
Member

jieyouxu commented Mar 1, 2025

I seem to recall that list is manually edited but could be wrong.

@jieyouxu jieyouxu added A-diagnostics Area: Messages for errors, warnings, and lints and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Mar 1, 2025
@Noratrieb
Copy link
Member

Noratrieb commented Mar 1, 2025

Yeah, that seems to be the case.
The very easy but not great PR is to just change help to match again, but it would be even nicer if this was wired up in a way that didn't require editing it manually, because it will definitely be forgotten again.

@mtoner23
Copy link
Contributor

mtoner23 commented Mar 1, 2025

Hi, new to rust development, but i have a change locally to make this always print every --print type. i'll get it in a PR later tonight

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 3, 2025
ensure we always print all --print options in help

Closes rust-lang#137853
Refactors the PRINT_KINDS map into a public const so we always print every option for print. the list is quite long now, and idk if long term we want to keep printing all these options from --help.
@bors bors closed this as completed in 1998cf7 Mar 4, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 4, 2025
Rollup merge of rust-lang#137862 - mtoner23:print-help, r=nnethercote

ensure we always print all --print options in help

Closes rust-lang#137853
Refactors the PRINT_KINDS map into a public const so we always print every option for print. the list is quite long now, and idk if long term we want to keep printing all these options from --help.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CLI Area: Command-line interface (CLI) to the compiler A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants