rustrust-cargosemantic-versioning

Cargo does not match `rend = "^0.5"` against 0.5.0-pre2


I added the following line in my Cargo.toml:

rkyv = { git = "https://github.com/rkyv/rkyv", rev = "e2b0241a209e70e2fdd7ec43386ee72e2021d1a8" }

where e2b024 depends on

rend = { version = "0.5", git = "https://github.com/rkyv/rend", branch = "master", default-features = false }

rend/Cargo.toml has

[package]
name = "rend"
version = "0.5.0-pre2"

However cargo check on my project complains there is incompatibility between specified versions.

Error: `cargo metadata` exited with an error:     Updating crates.io index
    Updating git repository `https://github.com/rkyv/rkyv`
    Updating git repository `https://github.com/rkyv/rend`
error: failed to select a version for the requirement `rend = "^0.5"`
candidate versions found which didn't match: 0.5.0-pre2
location searched: Git repository https://github.com/rkyv/rend?branch=master
required by package `rkyv v0.8.0 (https://github.com/rkyv/rkyv?rev=e2b0241a209e70e2fdd7ec43386ee72e2021d1a8#e2b0241a)`

The following site says the semver constraint '^0.5' matches '0.5.0-pre2'.

https://jubianchi.github.io/semver-check/#/^0.5/0.5.0-pre2

Is there a workaround in my Cargo.toml to make this work without cloning and modifying github.com/rkyv/*?


Solution

  • As @chayim-friedman said, cargo will not match "0.5" against "0.5.0-pre2".