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 in src/librust_driver/lib.rs not really distinguishing between cases such as -help (in which the return 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).
I tried this code:
rustc -Wall main.rs && ./mainI expected to see this happen:
rustcprints an error message saying that-Wallis not supported and exits with a non-zero exit status.Instead, this happened:
rustcprints 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_optionsinsrc/librust_driver/lib.rsnot really distinguishing between cases such as-help(in which thereturn Nonemakes 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
-Wallparameter as a warning, and to continue compilation normally (the way the deprecated "no-stack-check" is handled).