Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustc should return error code for unsupported command line option (-Wall) #69844

Closed
astoeckel opened this issue Mar 9, 2020 · 2 comments
Closed
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.

Comments

@astoeckel
Copy link

astoeckel commented Mar 9, 2020

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).

@astoeckel astoeckel added the C-bug Category: This is a bug. label Mar 9, 2020
@Centril Centril added 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. and removed C-bug Category: This is a bug. labels Mar 9, 2020
@SummerGram
Copy link

Hi,
I would like to work on this issue.

@tmiasko
Copy link
Contributor

tmiasko commented Jan 14, 2022

Since #92504 rustc -Wall now results in non-zero exit status.

@tmiasko tmiasko closed this as completed Jan 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

No branches or pull requests

4 participants