Skip to content

rustc book: Outdated parameters for --print #138698

Closed
@xizheyin

Description

@xizheyin
Contributor

Location

https://doc.rust-lang.org/rustc/command-line-arguments.html#--print-print-compiler-information

Summary

When I use rustc ---print, it reports

       Usage:
           --print [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]

But some of them can not be found in the corresponding chapter in rustc book. And the order in which the parameters are arranged needs to be adjusted.

Activity

added
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and tools
on Mar 19, 2025
added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Mar 19, 2025
Urgau

Urgau commented on Mar 19, 2025

@Urgau
Member

But some of them can not be found in the corresponding chapter in rustc book

That's because some of them are unstable.

And the order in which the parameters are arranged needs to be adjusted.

What do you mean by "adjusted"?

added
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
A-print-requestsArea: print requests (`--print=...`)
and removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Mar 19, 2025
ChrisDenton

ChrisDenton commented on Mar 19, 2025

@ChrisDenton
Member

We should probably try to hide the unstable options on stable? Although that might be more difficult to do since I don't think stable/unstable is easy to query.

xizheyin

xizheyin commented on Mar 19, 2025

@xizheyin
ContributorAuthor

What do you mean by "adjusted"?

Alphabetical order may be more beautiful.

We should probably try to hide the unstable options on stable?

I think so, too, otherwise it may cause confusion.Is it possible to mark as unstable?

jieyouxu

jieyouxu commented on Mar 19, 2025

@jieyouxu
Member

It should be possible to hide the unstable options on stable due to how print requests are handed: see

let kind = if let Some((print_name, print_kind)) =
PRINT_KINDS.iter().find(|&&(name, _)| name == req)
{
check_print_request_stability(early_dcx, unstable_opts, (print_name, *print_kind));
*print_kind
} else {
emit_unknown_print_request_help(early_dcx, req)
};

Probably just pull out the "what is considered unstable print request" logic

fn check_print_request_stability(
early_dcx: &EarlyDiagCtxt,
unstable_opts: &UnstableOptions,
(print_name, print_kind): (&str, PrintKind),
) {
match print_kind {
PrintKind::AllTargetSpecsJson | PrintKind::CheckCfg | PrintKind::TargetSpecJson
if !unstable_opts.unstable_options =>
{
early_dcx.early_fatal(format!(
"the `-Z unstable-options` flag must also be passed to enable the `{print_name}` \
print option"
));
}
_ => {}
}
}

(There might be a bit more nuance to this, I haven't tried implementing it)

xizheyin

xizheyin commented on Apr 7, 2025

@xizheyin
ContributorAuthor

jieyou, are you going to do this? If not, I can give it a try. @jieyouxu

jieyouxu

jieyouxu commented on Apr 7, 2025

@jieyouxu
Member

I am not working on this, no.

added 3 commits that reference this issue on Apr 17, 2025

Rollup merge of rust-lang#139850 - xizheyin:issue-138698, r=jieyouxu

bd3c3ba

Rollup merge of rust-lang#139850 - xizheyin:issue-138698, r=jieyouxu

76c06b6

Rollup merge of rust-lang#139850 - xizheyin:issue-138698, r=jieyouxu

d2db1c1

2 remaining items

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-print-requestsArea: print requests (`--print=...`)T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @Urgau@ChrisDenton@jieyouxu@rustbot@xizheyin

      Issue actions

        rustc book: Outdated parameters for `--print` · Issue #138698 · rust-lang/rust