ensure we always print all --print options in help
This commit is contained in:
parent
8c392966a0
commit
6f505ba767
4 changed files with 37 additions and 33 deletions
|
@ -42,6 +42,32 @@ mod cfg;
|
||||||
mod native_libs;
|
mod native_libs;
|
||||||
pub mod sigpipe;
|
pub mod sigpipe;
|
||||||
|
|
||||||
|
pub const PRINT_KINDS: &[(&str, PrintKind)] = &[
|
||||||
|
// tidy-alphabetical-start
|
||||||
|
("all-target-specs-json", PrintKind::AllTargetSpecs),
|
||||||
|
("calling-conventions", PrintKind::CallingConventions),
|
||||||
|
("cfg", PrintKind::Cfg),
|
||||||
|
("check-cfg", PrintKind::CheckCfg),
|
||||||
|
("code-models", PrintKind::CodeModels),
|
||||||
|
("crate-name", PrintKind::CrateName),
|
||||||
|
("deployment-target", PrintKind::DeploymentTarget),
|
||||||
|
("file-names", PrintKind::FileNames),
|
||||||
|
("host-tuple", PrintKind::HostTuple),
|
||||||
|
("link-args", PrintKind::LinkArgs),
|
||||||
|
("native-static-libs", PrintKind::NativeStaticLibs),
|
||||||
|
("relocation-models", PrintKind::RelocationModels),
|
||||||
|
("split-debuginfo", PrintKind::SplitDebuginfo),
|
||||||
|
("stack-protector-strategies", PrintKind::StackProtectorStrategies),
|
||||||
|
("sysroot", PrintKind::Sysroot),
|
||||||
|
("target-cpus", PrintKind::TargetCPUs),
|
||||||
|
("target-features", PrintKind::TargetFeatures),
|
||||||
|
("target-libdir", PrintKind::TargetLibdir),
|
||||||
|
("target-list", PrintKind::TargetList),
|
||||||
|
("target-spec-json", PrintKind::TargetSpec),
|
||||||
|
("tls-models", PrintKind::TlsModels),
|
||||||
|
// tidy-alphabetical-end
|
||||||
|
];
|
||||||
|
|
||||||
/// The different settings that the `-C strip` flag can have.
|
/// The different settings that the `-C strip` flag can have.
|
||||||
#[derive(Clone, Copy, PartialEq, Hash, Debug)]
|
#[derive(Clone, Copy, PartialEq, Hash, Debug)]
|
||||||
pub enum Strip {
|
pub enum Strip {
|
||||||
|
@ -1508,6 +1534,13 @@ The default is {DEFAULT_EDITION} and the latest stable edition is {LATEST_STABLE
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
static PRINT_KINDS_STRING: LazyLock<String> = LazyLock::new(|| {
|
||||||
|
format!(
|
||||||
|
"[{}]",
|
||||||
|
PRINT_KINDS.iter().map(|(name, _)| format!("{name}")).collect::<Vec<_>>().join("|")
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
/// Returns all rustc command line options, including metadata for
|
/// Returns all rustc command line options, including metadata for
|
||||||
/// each option, such as whether the option is stable.
|
/// each option, such as whether the option is stable.
|
||||||
pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
|
pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
|
||||||
|
@ -1568,10 +1601,7 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
|
||||||
"",
|
"",
|
||||||
"print",
|
"print",
|
||||||
"Compiler information to print on stdout",
|
"Compiler information to print on stdout",
|
||||||
"[crate-name|file-names|sysroot|target-libdir|cfg|check-cfg|calling-conventions|\
|
&PRINT_KINDS_STRING,
|
||||||
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]",
|
|
||||||
),
|
),
|
||||||
opt(Stable, FlagMulti, "g", "", "Equivalent to -C debuginfo=2", ""),
|
opt(Stable, FlagMulti, "g", "", "Equivalent to -C debuginfo=2", ""),
|
||||||
opt(Stable, FlagMulti, "O", "", "Equivalent to -C opt-level=3", ""),
|
opt(Stable, FlagMulti, "O", "", "Equivalent to -C opt-level=3", ""),
|
||||||
|
@ -1999,32 +2029,6 @@ fn collect_print_requests(
|
||||||
cg.target_feature = String::new();
|
cg.target_feature = String::new();
|
||||||
}
|
}
|
||||||
|
|
||||||
const PRINT_KINDS: &[(&str, PrintKind)] = &[
|
|
||||||
// tidy-alphabetical-start
|
|
||||||
("all-target-specs-json", PrintKind::AllTargetSpecs),
|
|
||||||
("calling-conventions", PrintKind::CallingConventions),
|
|
||||||
("cfg", PrintKind::Cfg),
|
|
||||||
("check-cfg", PrintKind::CheckCfg),
|
|
||||||
("code-models", PrintKind::CodeModels),
|
|
||||||
("crate-name", PrintKind::CrateName),
|
|
||||||
("deployment-target", PrintKind::DeploymentTarget),
|
|
||||||
("file-names", PrintKind::FileNames),
|
|
||||||
("host-tuple", PrintKind::HostTuple),
|
|
||||||
("link-args", PrintKind::LinkArgs),
|
|
||||||
("native-static-libs", PrintKind::NativeStaticLibs),
|
|
||||||
("relocation-models", PrintKind::RelocationModels),
|
|
||||||
("split-debuginfo", PrintKind::SplitDebuginfo),
|
|
||||||
("stack-protector-strategies", PrintKind::StackProtectorStrategies),
|
|
||||||
("sysroot", PrintKind::Sysroot),
|
|
||||||
("target-cpus", PrintKind::TargetCPUs),
|
|
||||||
("target-features", PrintKind::TargetFeatures),
|
|
||||||
("target-libdir", PrintKind::TargetLibdir),
|
|
||||||
("target-list", PrintKind::TargetList),
|
|
||||||
("target-spec-json", PrintKind::TargetSpec),
|
|
||||||
("tls-models", PrintKind::TlsModels),
|
|
||||||
// tidy-alphabetical-end
|
|
||||||
];
|
|
||||||
|
|
||||||
// We disallow reusing the same path in multiple prints, such as `--print
|
// We disallow reusing the same path in multiple prints, such as `--print
|
||||||
// cfg=output.txt --print link-args=output.txt`, because outputs are printed
|
// cfg=output.txt --print link-args=output.txt`, because outputs are printed
|
||||||
// by disparate pieces of the compiler, and keeping track of which files
|
// by disparate pieces of the compiler, and keeping track of which files
|
||||||
|
|
|
@ -29,7 +29,7 @@ Options:
|
||||||
--emit [asm|llvm-bc|llvm-ir|obj|metadata|link|dep-info|mir]
|
--emit [asm|llvm-bc|llvm-ir|obj|metadata|link|dep-info|mir]
|
||||||
Comma separated list of types of output for the
|
Comma separated list of types of output for the
|
||||||
compiler to emit
|
compiler to emit
|
||||||
--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]
|
--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]
|
||||||
Compiler information to print on stdout
|
Compiler information to print on stdout
|
||||||
-g Equivalent to -C debuginfo=2
|
-g Equivalent to -C debuginfo=2
|
||||||
-O Equivalent to -C opt-level=3
|
-O Equivalent to -C opt-level=3
|
||||||
|
|
|
@ -29,7 +29,7 @@ Options:
|
||||||
--emit [asm|llvm-bc|llvm-ir|obj|metadata|link|dep-info|mir]
|
--emit [asm|llvm-bc|llvm-ir|obj|metadata|link|dep-info|mir]
|
||||||
Comma separated list of types of output for the
|
Comma separated list of types of output for the
|
||||||
compiler to emit
|
compiler to emit
|
||||||
--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]
|
--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]
|
||||||
Compiler information to print on stdout
|
Compiler information to print on stdout
|
||||||
-g Equivalent to -C debuginfo=2
|
-g Equivalent to -C debuginfo=2
|
||||||
-O Equivalent to -C opt-level=3
|
-O Equivalent to -C opt-level=3
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error: Argument to option 'print' missing
|
error: Argument to option 'print' missing
|
||||||
Usage:
|
Usage:
|
||||||
--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]
|
--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]
|
||||||
Compiler information to print on stdout
|
Compiler information to print on stdout
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue