Improve diagnostic for unknown --print request
This commit is contained in:
parent
b3e117044c
commit
153b1f0421
@ -1888,9 +1888,12 @@ fn collect_print_requests(
|
|||||||
let prints =
|
let prints =
|
||||||
PRINT_KINDS.iter().map(|(name, _)| format!("`{name}`")).collect::<Vec<_>>();
|
PRINT_KINDS.iter().map(|(name, _)| format!("`{name}`")).collect::<Vec<_>>();
|
||||||
let prints = prints.join(", ");
|
let prints = prints.join(", ");
|
||||||
early_dcx.early_fatal(format!(
|
|
||||||
"unknown print request `{req}`. Valid print requests are: {prints}"
|
let mut diag =
|
||||||
));
|
early_dcx.early_struct_fatal(format!("unknown print request: `{req}`"));
|
||||||
|
#[allow(rustc::diagnostic_outside_of_impl)]
|
||||||
|
diag.help(format!("valid print requests are: {prints}"));
|
||||||
|
diag.emit()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -317,7 +317,6 @@ run-make/unstable-flag-required/Makefile
|
|||||||
run-make/use-suggestions-rust-2018/Makefile
|
run-make/use-suggestions-rust-2018/Makefile
|
||||||
run-make/used-cdylib-macos/Makefile
|
run-make/used-cdylib-macos/Makefile
|
||||||
run-make/used/Makefile
|
run-make/used/Makefile
|
||||||
run-make/valid-print-requests/Makefile
|
|
||||||
run-make/volatile-intrinsics/Makefile
|
run-make/volatile-intrinsics/Makefile
|
||||||
run-make/wasm-exceptions-nostd/Makefile
|
run-make/wasm-exceptions-nostd/Makefile
|
||||||
run-make/wasm-override-linker/Makefile
|
run-make/wasm-override-linker/Makefile
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
include ../tools.mk
|
|
||||||
|
|
||||||
all:
|
|
||||||
$(RUSTC) --print uwu 2>&1 | diff - valid-print-requests.stderr
|
|
@ -1,2 +0,0 @@
|
|||||||
error: unknown print request `uwu`. Valid print requests are: `all-target-specs-json`, `calling-conventions`, `cfg`, `code-models`, `crate-name`, `deployment-target`, `file-names`, `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`
|
|
||||||
|
|
1
tests/ui/invalid-compile-flags/print.rs
Normal file
1
tests/ui/invalid-compile-flags/print.rs
Normal file
@ -0,0 +1 @@
|
|||||||
|
//@ compile-flags: --print yyyy
|
4
tests/ui/invalid-compile-flags/print.stderr
Normal file
4
tests/ui/invalid-compile-flags/print.stderr
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
error: unknown print request: `yyyy`
|
||||||
|
|
|
||||||
|
= help: valid print requests are: `all-target-specs-json`, `calling-conventions`, `cfg`, `code-models`, `crate-name`, `deployment-target`, `file-names`, `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`
|
||||||
|
|
Loading…
Reference in New Issue
Block a user