dtolnay / semver

Parser and evaluator for Cargo's flavor of Semantic Versioning

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[question] Does VersionReq behave the same if the patch version is omitted?

suyashb95 opened this issue · comments

According to the docs on VersionReq, 1.2.3 and ^1.2.3 are treated the same. This doesn't seem to be true if the patch version is not specified. Is that intentional?

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=f5f25e18aa79eaa8a6837773c6ef1561

Same question here. I spend some time figuring out why my code limits version specified as 1.0 to the range of ≥1.0.0 and <1.1.0, while I was expecting the upper bound to be <2.0.0. Turned out to be because of SemVer.

It does not match the way how Cargo versioning works.

It looks like this behaviour changed between 0.10.0 and 0.11.0 and the reason Cargo sees different behaviour is it's currently on 0.10.0.

/cc @hone

This is fixed in semver 1.0.0. major.minor and ^major.minor mean the same thing.