Skip to content

Improve error message when attempting to use a crate that was created as a staticlib instead of an rlib. #14416

Closed
@ahmedcharles

Description

@ahmedcharles

If a crate is created as a staticlib, which is for linking against C programs, the error message that is gotten when trying to use that create from Rust is:

foo.rs:3:1: 3:26 error: can't find crate for `bar`
foo.rs:3 extern crate bar;
            ^~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error

It would be better if the error message were:

foo.rs:3:1: 3:26 error: found staticlib `bar` instead of rlib `bar`, please compile using --crate-type rlib instead.
foo.rs:3 extern crate bar;
            ^~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error

Or something similarly useful.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions