Cargo can't resolve dependencies when you must have two different semver compatible version of a crate. Bug or feature?
Example - main Cargo.toml
[package]
name = "failing-example"
version = "0.1.0"
[dependencies]
a = { path = "a" }
b = { path = "b" }
a/Cargo.toml
:
[package]
name = "a"
version = "0.1.0"
[dependencies]
libc = "= 0.2.43"
b/Cargo.toml
:
[package]
name = "b"
version = "0.1.0"
[dependencies]
libc = "= 0.2.42"
Trying to compile:
Updating registry `https://github.com/rust-lang/crates.io-index`
error: failed to select a version for `libc`.
... required by package `b v0.1.0 (file:///C:/Users/kuviman/failing-example/b)`
... which is depended on by `hello v0.1.0 (file:///C:/Users/kuviman/failing-example)`
versions that meet the requirements `= 0.2.42` are: 0.2.42
all possible versions conflict with previously selected packages.
previously selected package `libc v0.2.43`
... which is depended on by `a v0.1.0 (file:///C:/Users/kuviman/failing-example/a)`
... which is depended on by `hello v0.1.0 (file:///C:/Users/kuviman/failing-example)`
failed to select a version for `libc` which could resolve this conflict
If dependencies were semver-incompatible, this would compile.
In the actual project, do I have to fix my dependencies (this is deeply nested actually)? Maybe by duplicating the errored crate so there is no conflict. Or is there a better solution?