From: bors Date: Wed, 28 Jun 2017 06:39:50 +0000 (+0000) Subject: Auto merge of #4229 - azerupi:install-version-range, r=matklad X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~8^2~22 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=64c3217eb459da25df9f9a9818b7775b4387ae8c;p=cargo.git Auto merge of #4229 - azerupi:install-version-range, r=matklad Implement semver ranges for install --vers This implements the design discussed in #4207 It allows to specify semver ranges on `cargo install ... --vers` 1. The first character of the `--vers` value is checked, if there is none we return an error. 2. If it is one of `<`, `>`, `=`, `^`, `~` we parse the value as a `VersionReq`, otherwise we parse it as a `Version`. 3. If the parsing as a `Version` fails but parsing as `VersionReq` succeeds, we add a note to the warning mentioning that a qualifier should be used to specify a semver range. This catches versions with less than tree digits. Otherwise, the previous behaviour is preserved with the warning of backwards compatibility. This means that - `cargo install ... --vers "^1.2.3"` will be parsed as a range - `cargo install ... --vers 1.2.3` will be parsed as a version - `cargo install ... --vers 1.2` will be parsed as a version for backwards compatibility reasons, fail and be passed through as is,**but** we will add a note `if you want to specify semver range, add an explicit qualifier, like ^1.2` - `cargo install ... --vers blah` will be parsed as a version for backwards compatibility reasons (which is weird because it is not even a valid semver range) and produce an `unknown error` down the line. I have left this behaviour untouched because it worked like that before, but I can easily make it error sooner with a better message. --- 64c3217eb459da25df9f9a9818b7775b4387ae8c