The dependency resolution is confused when using git dependency and there's a lockfile #11490
Labels
A-git
Area: anything dealing with git
A-lockfile
Area: Cargo.lock issues
C-bug
Category: bug
S-needs-design
Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
Problem
I'm working on some piece of proprietary code, and for the internal dependencies, we use git repositories instead of crates on crates.io or some internal registry.
Today I faced I really annoying error message:
So it complains that the type comes from different versions of the
lower
crate, whereas it comes from the same version as we can see in the error message itself (for both, it'srepro_cargo_lower-dc970fbba3cb3609/5914bef
).I was very confused for a while and then I managed to understand what's going on an reproduce it:
Steps
git clone [email protected]:StyMaar/repro_cargo_top.git
cargo check
Notes
The problem comes from the
upper
dependency which does not specify the target commit (there is norev
in the declaration of thelower
dependency inupper
) but there's aCargo.lock
file which points to the same revision oflower
as the one being used in the top-level crate.In the end, the
lower
dependency is imported twice for the same revision, since cargo doesn't realize that it's in fact the same revision, and then rustc complains about the presence of two different types.Version
The text was updated successfully, but these errors were encountered: