rustc should return error code for unsupported command line option (-Wall) #69844
Labels
C-feature-request
Category: A feature request, i.e: not implemented / a PR.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I tried this code:
rustc -Wall main.rs && ./main
I expected to see this happen:
rustc
prints an error message saying that-Wall
is not supported and exits with a non-zero exit status.Instead, this happened:
rustc
prints an error message and immediately returns with a zero exit status, causing an old version of "./main" to be executed. I would expect all error messages that cancel compilation to cause a non-zero exit code.Additional details:
This problem is caused by
handle_options
insrc/librust_driver/lib.rs
not really distinguishing between cases such as-help
(in which thereturn None
makes sense); and downright invalid options such as-Wall
, which should explicitly print an error message and abort with an error code.An alternative solution would be to inform about the missing
-Wall
parameter as a warning, and to continue compilation normally (the way the deprecated "no-stack-check" is handled).The text was updated successfully, but these errors were encountered: