Skip to content

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

Closed
@astoeckel

Description

@astoeckel

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions