No warning when Git dependency repository contains multiple packages with the same name #10669
Labels
A-diagnostics
Area: Error and warning messages generated by Cargo itself.
C-bug
Category: bug
E-easy
Experience: Easy
Problem
I have this minimal example project, which depends on
foobar
package from this repository, which in turn has multiple places defining packagefoobar
.Now there is no warning or error when cargo selects one arbitrary instance of
foobar
to use. After a bit of experimenting I also couldn't find any logic in what particular instance is selected — it's seemingly stable across compilations, but there's no obvious connection to lexical sorting of paths or their depth.Steps
git clone https://github.com/toriningen/cargo-project-with-ambiguous-dependency
cd cargo-project-with-ambiguous-dependency
cargo build
. It builds without complaining.cargo run
. It shows any of three paths wherefoobar
is defined inhttps://github.com/toriningen/ambiguous-cargo-git-dependency
.Possible Solution(s)
It would have been nice if cargo could bail out stating that
foobar
is defined in multiple places, or at least warn (indicating particular selected path) about this condition.Notes
Real world case might be when somebody has lots of similar self-registering components under some common directory, and copies their Cargo.toml files, forgetting to rename the package, which could go unnoticed for some time.
Version
The text was updated successfully, but these errors were encountered: