Skip to content

Commit 5a52b5d

Browse files
committed
Suggest -Whelp when pass --print lints to rustc
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
1 parent 9bad8ac commit 5a52b5d

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

compiler/rustc_session/src/config.rs

+6
Original file line numberDiff line numberDiff line change
@@ -2082,6 +2082,12 @@ fn emit_unknown_print_request_help(early_dcx: &EarlyDiagCtxt, req: &str) -> ! {
20822082
let mut diag = early_dcx.early_struct_fatal(format!("unknown print request: `{req}`"));
20832083
#[allow(rustc::diagnostic_outside_of_impl)]
20842084
diag.help(format!("valid print requests are: {prints}"));
2085+
2086+
if req == "lints" {
2087+
diag.help(format!("use `-Whelp` to print a list of lints"));
2088+
}
2089+
2090+
diag.help(format!("for more information, see the rustc book: https://doc.rust-lang.org/rustc/command-line-arguments.html#--print-print-compiler-information"));
20852091
diag.emit()
20862092
}
20872093

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
error: unknown print request: `yyyy`
22
|
33
= 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`
4+
= help: for more information, see the rustc book: https://doc.rust-lang.org/rustc/command-line-arguments.html#--print-print-compiler-information
45

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
//@ check-fail
2+
//@ compile-flags: /dev/null --print lints
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
error: unknown print request: `lints`
2+
|
3+
= 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`
4+
= help: use `-Whelp` to print a list of lints
5+
= help: for more information, see the rustc book: https://doc.rust-lang.org/rustc/command-line-arguments.html#--print-print-compiler-information
6+

0 commit comments

Comments
 (0)