Skip to content

-Dunused-crate-dependency --json unused-externs doesn't cause rustc to exit with error status #96068

Closed
@jsgf

Description

@jsgf

Given the following code:
t.rs:

fn main() {}

unused.rs:

// empty
rustc --crate-type lib unused.rs
rustc --crate-type bin t.rs --extern unused=libunused.rlib -Dunused-crate-dependencies -Zunstable-options --error-format=json --json unused-externs

The current output is:

{"lint_level":"deny","unused_extern_names":["unused"]}

It reports a "deny" level event as expected, but it does not cause rustc to exit with a non-zero status.

I think it should since this is a fatal compiler diagnostic, I think it should exit with an error code. Of course a process monitoring the json stream could treat the "deny" level as a fatal error, but it seems odd to have a special case just for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsT-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