Skip to content

Warn if dependency doesn't have library target kind #6702

Description

@jethrogb

When specifying a crate without a library target kind as a dependency, cargo currently just silently ignores it. For example:

[package]
name = "deptest"
version = "0.1.0"
edition = "2018"

[dependencies]
ripgrep = "*"
$ cargo run
   Compiling deptest v0.1.0 (/tmp/deptest)
    Finished dev [unoptimized + debuginfo] target(s) in 0.31s
     Running `target/debug/deptest`
Hello, world!

Note that the dependency isn't even compiled. Clearly, Cargo has already decided to elide this crate in the dependency graph, but the cause is not obvious to the user. All this can be confusing if the user is expecting to be able to use the dependency. I think a warning message is in order.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-crate-dependenciesArea: [dependencies] of any kindA-diagnosticsArea: Error and warning messages generated by Cargo itself.C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`E-easyExperience: Easy

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions