You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found a strange behavior of the Cargo that looks like a bug. In my case I have a library defined as a dependency in multiple places with different version criteria. All of them may conclude to just one version that fits all criteria, but Cargo decided to use two versions of the same lib and it introduces a compilation conflict.
Here is my setup, look at the bitcoin version:
Lib main have:
[dependencies]
bitcoin = ">= 0.27, < 0.28"
hdpath = { version = "~0.6", features = ["with-bitcoin"] }
emerald-hwkey = "~0.2"
But in practice I see that Cargo decides to use the latest version 0.28.1 for hdpath and 0.27.1 for others. So the project cannot compile because of two different versions of the same lib.
Thanks for the report! Cargo's resolver tries to pick the newest version, even if that results in duplicates. Ideally it might try harder to prevent that from happening. I suggest sticking with caret requirements as much as possible, although I realize that may be difficult or impossible.
Closing as a duplicate of #9029, and of the work on public/private dependencies (#6129), and future resolver work (#5284).
Problem
I found a strange behavior of the Cargo that looks like a bug. In my case I have a library defined as a dependency in multiple places with different version criteria. All of them may conclude to just one version that fits all criteria, but Cargo decided to use two versions of the same lib and it introduces a compilation conflict.
Here is my setup, look at the
bitcoin
version:Lib main have:
where
hdpath
is:and
emerald-hwkey
is:So as a result we have the following criteria for
bitcoin
lib:So a version like
0.27.1
should work.But in practice I see that Cargo decides to use the latest version
0.28.1
forhdpath
and0.27.1
for others. So the project cannot compile because of two different versions of the same lib.I.e., if I check
cargo tree
I see:It's unclear why Cargo decides to upgrade here, it doesn't make much sense
Steps
No response
Possible Solution(s)
No response
Notes
It's also discussed here: https://stackoverflow.com/questions/72523805/cargo-publish-uses-different-dependency-version and reported in emeraldpay/hdpath-rs#2
Version
The text was updated successfully, but these errors were encountered: