diff options
Diffstat (limited to '')
-rw-r--r-- | vendor/semver/.cargo-checksum.json | 2 | ||||
-rw-r--r-- | vendor/semver/Cargo.toml | 2 | ||||
-rw-r--r-- | vendor/semver/src/impls.rs | 4 | ||||
-rw-r--r-- | vendor/semver/src/lib.rs | 50 | ||||
-rw-r--r-- | vendor/semver/tests/test_identifier.rs | 6 | ||||
-rw-r--r-- | vendor/semver/tests/test_version.rs | 12 | ||||
-rw-r--r-- | vendor/semver/tests/test_version_req.rs | 44 | ||||
-rw-r--r-- | vendor/semver/tests/util/mod.rs | 17 |
8 files changed, 130 insertions, 7 deletions
diff --git a/vendor/semver/.cargo-checksum.json b/vendor/semver/.cargo-checksum.json index 8b2094b6e..33c899ea0 100644 --- a/vendor/semver/.cargo-checksum.json +++ b/vendor/semver/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"b596875460fd9bbd7c3bd1d3f13f4dd70ccf88ee25fae4bc996f99b179148588","LICENSE-APACHE":"62c7a1e35f56406896d7aa7ca52d0cc0d272ac022b5d2796e7d6905db8a3636a","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"de1a03443ab8f147676199856a975ec00f3f7334fc5d5d5e056ec8f3fcb61dd5","benches/parse.rs":"6531f66f80ce2fc83878f9bf84f94c42e96f1e709466f2b88be8d95a3cec1511","build.rs":"9a3d42e37b665745044b5d91c6e02dd458152e336a7013654972f4a1a0b562d9","src/backport.rs":"66db55d15d0e2808bffe4cde7cd1d99bda999b26cbe40bb6b5e43b94f9b631d2","src/display.rs":"9ba42f7a6579aa9c7dd72f2380036f5c9664592f3eacd09ea25cef291a3e64e5","src/error.rs":"895e11a9e454cab207415186b15a29dac1f0a5bf9b8dba7bd45da5bb5a6ace31","src/eval.rs":"b7e7ec976051b9f87ddf5cfdbaad64654d98d86ae0763f7d88b14eeaeac6013c","src/identifier.rs":"459725383cbd0e2d769aa947decd1f031bdc8732339783ad24eb2b44f0f5d040","src/impls.rs":"79b5a2ac6ca3d4cb46adfb1494756079f53bef780dd81c3a8d3adf86f91395c8","src/lib.rs":"280ffdd4bda1aa7fed6c32e5ff57aac382d3619283a675fd23e6f9951f4bd001","src/parse.rs":"920f8327a1ba0c16a28f518f2d50998faf1d6a8db379b92cb72976f176650f09","src/serde.rs":"e2a9b9dc3cd2cccc250eaffad049de418ef791bf8c4a34111a48f068353e0a37","tests/node/mod.rs":"2710d9b8daace2038b66db0f8f4cc522dee938e7cbc42d7739c31995343c32f4","tests/test_autotrait.rs":"2631b78c9c63f1829c814fa88fcab0c5d77eb4e2d9c0c418d50c33e12a511e90","tests/test_identifier.rs":"6c3da46c73df210527b60f1069131b15e2c65eb7b5d11793940d00cf66812f4d","tests/test_version.rs":"4f45827cdab1d965f73b93662b84007d056135c97d5ffaa9973c1d9f58666785","tests/test_version_req.rs":"b6eea0258cc3b6d567a9f6c42693a97316345083495236c47e85374fd45f7cf0","tests/util/mod.rs":"db61c2cd86af864d8be4f2a3d5f25c86d7712201cc6ab47b715facf5f7f275b7"},"package":"b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918"}
\ No newline at end of file +{"files":{"Cargo.toml":"f271bcfad60d3df30778405a9cf9970c4b6eacb328ab36cdfc6c0f1060a56286","LICENSE-APACHE":"62c7a1e35f56406896d7aa7ca52d0cc0d272ac022b5d2796e7d6905db8a3636a","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"de1a03443ab8f147676199856a975ec00f3f7334fc5d5d5e056ec8f3fcb61dd5","benches/parse.rs":"6531f66f80ce2fc83878f9bf84f94c42e96f1e709466f2b88be8d95a3cec1511","build.rs":"9a3d42e37b665745044b5d91c6e02dd458152e336a7013654972f4a1a0b562d9","src/backport.rs":"66db55d15d0e2808bffe4cde7cd1d99bda999b26cbe40bb6b5e43b94f9b631d2","src/display.rs":"9ba42f7a6579aa9c7dd72f2380036f5c9664592f3eacd09ea25cef291a3e64e5","src/error.rs":"895e11a9e454cab207415186b15a29dac1f0a5bf9b8dba7bd45da5bb5a6ace31","src/eval.rs":"b7e7ec976051b9f87ddf5cfdbaad64654d98d86ae0763f7d88b14eeaeac6013c","src/identifier.rs":"459725383cbd0e2d769aa947decd1f031bdc8732339783ad24eb2b44f0f5d040","src/impls.rs":"48baf552d28f6d0ce63da2d2d53a710222ed87834d44e8b0493a0827e1d718f2","src/lib.rs":"fa6ee9bfe44353ed9c5e07bcfd676a62070826e04fe669357dd53e940f73a3ce","src/parse.rs":"920f8327a1ba0c16a28f518f2d50998faf1d6a8db379b92cb72976f176650f09","src/serde.rs":"e2a9b9dc3cd2cccc250eaffad049de418ef791bf8c4a34111a48f068353e0a37","tests/node/mod.rs":"2710d9b8daace2038b66db0f8f4cc522dee938e7cbc42d7739c31995343c32f4","tests/test_autotrait.rs":"2631b78c9c63f1829c814fa88fcab0c5d77eb4e2d9c0c418d50c33e12a511e90","tests/test_identifier.rs":"fba0428bf5c43c733d17ca30952822ed6e1af6de1e5ef11bd8fb46c6b10f65fd","tests/test_version.rs":"9587d2c397524e1d33499d9bb2725fe746406fa4d162713b7f56029942a4a84b","tests/test_version_req.rs":"1aa4ad4f58f1ec3226b334d0f82b6ebae732585dd9b2c35328b576a1b3638a8d","tests/util/mod.rs":"b35cd4e7fcc9a6fa2496d163d716155ddd379e027ef9516c1af05ce0cf605ae1"},"package":"836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090"}
\ No newline at end of file diff --git a/vendor/semver/Cargo.toml b/vendor/semver/Cargo.toml index 64bb05ecc..682bccfeb 100644 --- a/vendor/semver/Cargo.toml +++ b/vendor/semver/Cargo.toml @@ -13,7 +13,7 @@ edition = "2018" rust-version = "1.31" name = "semver" -version = "1.0.18" +version = "1.0.20" authors = ["David Tolnay <dtolnay@gmail.com>"] description = "Parser and evaluator for Cargo's flavor of Semantic Versioning" documentation = "https://docs.rs/semver" diff --git a/vendor/semver/src/impls.rs b/vendor/semver/src/impls.rs index c3b6c6013..cc4fd415f 100644 --- a/vendor/semver/src/impls.rs +++ b/vendor/semver/src/impls.rs @@ -38,13 +38,13 @@ impl Deref for BuildMetadata { impl PartialOrd for Prerelease { fn partial_cmp(&self, rhs: &Self) -> Option<Ordering> { - Some(Ord::cmp(self, rhs)) + Some(self.cmp(rhs)) } } impl PartialOrd for BuildMetadata { fn partial_cmp(&self, rhs: &Self) -> Option<Ordering> { - Some(Ord::cmp(self, rhs)) + Some(self.cmp(rhs)) } } diff --git a/vendor/semver/src/lib.rs b/vendor/semver/src/lib.rs index d2c4eb378..9fb125513 100644 --- a/vendor/semver/src/lib.rs +++ b/vendor/semver/src/lib.rs @@ -60,7 +60,7 @@ //! //! [Specifying Dependencies]: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html -#![doc(html_root_url = "https://docs.rs/semver/1.0.18")] +#![doc(html_root_url = "https://docs.rs/semver/1.0.20")] #![cfg_attr(doc_cfg, feature(doc_cfg))] #![cfg_attr(all(not(feature = "std"), not(no_alloc_crate)), no_std)] #![cfg_attr(not(no_unsafe_op_in_unsafe_fn_lint), deny(unsafe_op_in_unsafe_fn))] @@ -102,6 +102,7 @@ mod serde; use crate::alloc::vec::Vec; use crate::identifier::Identifier; +use core::cmp::Ordering; use core::str::FromStr; #[allow(unused_imports)] @@ -431,6 +432,53 @@ impl Version { pub fn parse(text: &str) -> Result<Self, Error> { Version::from_str(text) } + + /// Compare the major, minor, patch, and pre-release value of two versions, + /// disregarding build metadata. Versions that differ only in build metadata + /// are considered equal. This comparison is what the SemVer spec refers to + /// as "precedence". + /// + /// # Example + /// + /// ``` + /// use semver::Version; + /// + /// let mut versions = [ + /// "1.20.0+c144a98".parse::<Version>().unwrap(), + /// "1.20.0".parse().unwrap(), + /// "1.0.0".parse().unwrap(), + /// "1.0.0-alpha".parse().unwrap(), + /// "1.20.0+bc17664".parse().unwrap(), + /// ]; + /// + /// // This is a stable sort, so it preserves the relative order of equal + /// // elements. The three 1.20.0 versions differ only in build metadata so + /// // they are not reordered relative to one another. + /// versions.sort_by(Version::cmp_precedence); + /// assert_eq!(versions, [ + /// "1.0.0-alpha".parse().unwrap(), + /// "1.0.0".parse().unwrap(), + /// "1.20.0+c144a98".parse().unwrap(), + /// "1.20.0".parse().unwrap(), + /// "1.20.0+bc17664".parse().unwrap(), + /// ]); + /// + /// // Totally order the versions, including comparing the build metadata. + /// versions.sort(); + /// assert_eq!(versions, [ + /// "1.0.0-alpha".parse().unwrap(), + /// "1.0.0".parse().unwrap(), + /// "1.20.0".parse().unwrap(), + /// "1.20.0+bc17664".parse().unwrap(), + /// "1.20.0+c144a98".parse().unwrap(), + /// ]); + /// ``` + pub fn cmp_precedence(&self, other: &Self) -> Ordering { + Ord::cmp( + &(self.major, self.minor, self.patch, &self.pre), + &(other.major, other.minor, other.patch, &other.pre), + ) + } } impl VersionReq { diff --git a/vendor/semver/tests/test_identifier.rs b/vendor/semver/tests/test_identifier.rs index dc888c9c1..40d859654 100644 --- a/vendor/semver/tests/test_identifier.rs +++ b/vendor/semver/tests/test_identifier.rs @@ -43,3 +43,9 @@ fn test_eq() { assert_ne!(prerelease("aaaaaaaaa"), prerelease("bbbbbbbbb")); assert_ne!(build_metadata("1"), build_metadata("001")); } + +#[test] +fn test_prerelease() { + let err = prerelease_err("1.b\0"); + assert_to_string(err, "unexpected character in pre-release identifier"); +} diff --git a/vendor/semver/tests/test_version.rs b/vendor/semver/tests/test_version.rs index de3628fac..991087f7d 100644 --- a/vendor/semver/tests/test_version.rs +++ b/vendor/semver/tests/test_version.rs @@ -47,6 +47,18 @@ fn test_parse() { let err = version_err("1.2.3-01"); assert_to_string(err, "invalid leading zero in pre-release identifier"); + let err = version_err("1.2.3++"); + assert_to_string(err, "empty identifier segment in build metadata"); + + let err = version_err("07"); + assert_to_string(err, "invalid leading zero in major version number"); + + let err = version_err("111111111111111111111.0.0"); + assert_to_string(err, "value of major version number exceeds u64::MAX"); + + let err = version_err("8\0"); + assert_to_string(err, "unexpected character '\\0' after major version number"); + let parsed = version("1.2.3"); let expected = Version::new(1, 2, 3); assert_eq!(parsed, expected); diff --git a/vendor/semver/tests/test_version_req.rs b/vendor/semver/tests/test_version_req.rs index 98a03ac89..1ed2358a3 100644 --- a/vendor/semver/tests/test_version_req.rs +++ b/vendor/semver/tests/test_version_req.rs @@ -168,6 +168,9 @@ pub fn test_multiple() { // https://github.com/steveklabnik/semver/issues/56 let err = req_err("1.2.3 - 2.3.4"); assert_to_string(err, "expected comma after patch version number, found '-'"); + + let err = req_err(">1, >2, >3, >4, >5, >6, >7, >8, >9, >10, >11, >12, >13, >14, >15, >16, >17, >18, >19, >20, >21, >22, >23, >24, >25, >26, >27, >28, >29, >30, >31, >32, >33"); + assert_to_string(err, "excessive number of version comparators"); } #[test] @@ -332,7 +335,7 @@ pub fn test_pre() { } #[test] -pub fn test_parse_errors() { +pub fn test_parse() { let err = req_err("\0"); assert_to_string( err, @@ -368,6 +371,45 @@ pub fn test_parse_errors() { } #[test] +fn test_comparator_parse() { + let parsed = comparator("1.2.3-alpha"); + assert_to_string(parsed, "^1.2.3-alpha"); + + let parsed = comparator("2.X"); + assert_to_string(parsed, "2.*"); + + let parsed = comparator("2"); + assert_to_string(parsed, "^2"); + + let parsed = comparator("2.x.x"); + assert_to_string(parsed, "2.*"); + + let err = comparator_err("1.2.3-01"); + assert_to_string(err, "invalid leading zero in pre-release identifier"); + + let err = comparator_err("1.2.3+4."); + assert_to_string(err, "empty identifier segment in build metadata"); + + let err = comparator_err(">"); + assert_to_string( + err, + "unexpected end of input while parsing major version number", + ); + + let err = comparator_err("1."); + assert_to_string( + err, + "unexpected end of input while parsing minor version number", + ); + + let err = comparator_err("1.*."); + assert_to_string(err, "unexpected character after wildcard in version req"); + + let err = comparator_err("1.2.3+4ÿ"); + assert_to_string(err, "unexpected character 'ÿ' after build metadata"); +} + +#[test] fn test_cargo3202() { let ref r = req("0.*.*"); assert_to_string(r, "0.*"); diff --git a/vendor/semver/tests/util/mod.rs b/vendor/semver/tests/util/mod.rs index 5cc142c48..07d691fab 100644 --- a/vendor/semver/tests/util/mod.rs +++ b/vendor/semver/tests/util/mod.rs @@ -1,6 +1,6 @@ #![allow(dead_code)] -use semver::{BuildMetadata, Error, Prerelease, Version, VersionReq}; +use semver::{BuildMetadata, Comparator, Error, Prerelease, Version, VersionReq}; use std::fmt::Display; #[cfg_attr(not(no_track_caller), track_caller)] @@ -24,11 +24,26 @@ pub(super) fn req_err(text: &str) -> Error { } #[cfg_attr(not(no_track_caller), track_caller)] +pub(super) fn comparator(text: &str) -> Comparator { + Comparator::parse(text).unwrap() +} + +#[cfg_attr(not(no_track_caller), track_caller)] +pub(super) fn comparator_err(text: &str) -> Error { + Comparator::parse(text).unwrap_err() +} + +#[cfg_attr(not(no_track_caller), track_caller)] pub(super) fn prerelease(text: &str) -> Prerelease { Prerelease::new(text).unwrap() } #[cfg_attr(not(no_track_caller), track_caller)] +pub(super) fn prerelease_err(text: &str) -> Error { + Prerelease::new(text).unwrap_err() +} + +#[cfg_attr(not(no_track_caller), track_caller)] pub(super) fn build_metadata(text: &str) -> BuildMetadata { BuildMetadata::new(text).unwrap() } |