Skip to content
/ rust Public
forked from rust-lang/rust

Commit 7dc3fec

Browse files
authored
Rollup merge of rust-lang#139799 - clubby789:print=file, r=jieyouxu
Specify `--print info=file` syntax in `--help` Closes rust-lang#139794 I moved the listing of information that can be printed to the help string as it's getting rather long and it makes the `[=FILE]` part easier to see
2 parents 1bceed8 + 1b46969 commit 7dc3fec

File tree

5 files changed

+16
-17
lines changed

5 files changed

+16
-17
lines changed

compiler/rustc_session/src/config.rs

+4-10
Original file line numberDiff line numberDiff line change
@@ -1560,9 +1560,10 @@ The default is {DEFAULT_EDITION} and the latest stable edition is {LATEST_STABLE
15601560
)
15611561
});
15621562

1563-
static PRINT_KINDS_STRING: LazyLock<String> = LazyLock::new(|| {
1563+
static PRINT_HELP: LazyLock<String> = LazyLock::new(|| {
15641564
format!(
1565-
"[{}]",
1565+
"Compiler information to print on stdout (or to a file)\n\
1566+
INFO may be one of ({}).",
15661567
PRINT_KINDS.iter().map(|(name, _)| format!("{name}")).collect::<Vec<_>>().join("|")
15671568
)
15681569
});
@@ -1621,14 +1622,7 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
16211622
"Comma separated list of types of output for the compiler to emit",
16221623
"[asm|llvm-bc|llvm-ir|obj|metadata|link|dep-info|mir]",
16231624
),
1624-
opt(
1625-
Stable,
1626-
Multi,
1627-
"",
1628-
"print",
1629-
"Compiler information to print on stdout",
1630-
&PRINT_KINDS_STRING,
1631-
),
1625+
opt(Stable, Multi, "", "print", &PRINT_HELP, "INFO[=FILE]"),
16321626
opt(Stable, FlagMulti, "g", "", "Equivalent to -C debuginfo=2", ""),
16331627
opt(Stable, FlagMulti, "O", "", "Equivalent to -C opt-level=3", ""),
16341628
opt(Stable, Opt, "o", "", "Write output to <filename>", "FILENAME"),

tests/run-make/rustc-help/help-v.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@@ -51,10 +51,27 @@
1+
@@ -53,10 +53,27 @@
22
Set a codegen option
33
-V, --version Print version info and exit
44
-v, --verbose Use verbose output

tests/run-make/rustc-help/help-v.stdout

+4-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ Options:
2929
--emit [asm|llvm-bc|llvm-ir|obj|metadata|link|dep-info|mir]
3030
Comma separated list of types of output for the
3131
compiler to emit
32-
--print [all-target-specs-json|calling-conventions|cfg|check-cfg|code-models|crate-name|crate-root-lint-levels|deployment-target|file-names|host-tuple|link-args|native-static-libs|relocation-models|split-debuginfo|stack-protector-strategies|supported-crate-types|sysroot|target-cpus|target-features|target-libdir|target-list|target-spec-json|tls-models]
33-
Compiler information to print on stdout
32+
--print INFO[=FILE]
33+
Compiler information to print on stdout (or to a file)
34+
INFO may be one of
35+
(all-target-specs-json|calling-conventions|cfg|check-cfg|code-models|crate-name|crate-root-lint-levels|deployment-target|file-names|host-tuple|link-args|native-static-libs|relocation-models|split-debuginfo|stack-protector-strategies|supported-crate-types|sysroot|target-cpus|target-features|target-libdir|target-list|target-spec-json|tls-models).
3436
-g Equivalent to -C debuginfo=2
3537
-O Equivalent to -C opt-level=3
3638
-o FILENAME Write output to <filename>

tests/run-make/rustc-help/help.stdout

+4-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ Options:
2929
--emit [asm|llvm-bc|llvm-ir|obj|metadata|link|dep-info|mir]
3030
Comma separated list of types of output for the
3131
compiler to emit
32-
--print [all-target-specs-json|calling-conventions|cfg|check-cfg|code-models|crate-name|crate-root-lint-levels|deployment-target|file-names|host-tuple|link-args|native-static-libs|relocation-models|split-debuginfo|stack-protector-strategies|supported-crate-types|sysroot|target-cpus|target-features|target-libdir|target-list|target-spec-json|tls-models]
33-
Compiler information to print on stdout
32+
--print INFO[=FILE]
33+
Compiler information to print on stdout (or to a file)
34+
INFO may be one of
35+
(all-target-specs-json|calling-conventions|cfg|check-cfg|code-models|crate-name|crate-root-lint-levels|deployment-target|file-names|host-tuple|link-args|native-static-libs|relocation-models|split-debuginfo|stack-protector-strategies|supported-crate-types|sysroot|target-cpus|target-features|target-libdir|target-list|target-spec-json|tls-models).
3436
-g Equivalent to -C debuginfo=2
3537
-O Equivalent to -C opt-level=3
3638
-o FILENAME Write output to <filename>
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
error: Argument to option 'print' missing
22
Usage:
3-
--print [all-target-specs-json|calling-conventions|cfg|check-cfg|code-models|crate-name|crate-root-lint-levels|deployment-target|file-names|host-tuple|link-args|native-static-libs|relocation-models|split-debuginfo|stack-protector-strategies|supported-crate-types|sysroot|target-cpus|target-features|target-libdir|target-list|target-spec-json|tls-models]
4-
Compiler information to print on stdout
3+
--print INFO[=FILE] Compiler information to print on stdout (or to a file)
4+
INFO may be one of
5+
(all-target-specs-json|calling-conventions|cfg|check-cfg|code-models|crate-name|crate-root-lint-levels|deployment-target|file-names|host-tuple|link-args|native-static-libs|relocation-models|split-debuginfo|stack-protector-strategies|supported-crate-types|sysroot|target-cpus|target-features|target-libdir|target-list|target-spec-json|tls-models).
56

0 commit comments

Comments
 (0)