3 # User Mike Hommey <mh+mozilla@glandium.org>
5 # Node ID f52e2ad948e88e2c4ce83599d379aa4a1e57334e
6 # Parent 969171da8cc09d4eb7c070b0ecf33bc5cc504537
7 Bug 1772048 - Update rustc_version and semver crates. r=emilio,webdriver-reviewers,kinetik,whimboo
9 semver 1.0 doesn't and won't support Clone on semver::Error[1], so we
10 convert the mozversion error type to store the string version of the
11 error, which is an incompatible change requiring a version bump on the
14 1. https://github.com/dtolnay/semver/pull/280
16 Differential Revision: https://phabricator.services.mozilla.com/D147825
18 diff --git a/.cargo/config.in b/.cargo/config.in
19 --- a/.cargo/config.in
20 +++ b/.cargo/config.in
21 @@ -25,17 +25,17 @@ rev = "3bfc47d9a571d0842676043ba60716318
22 [source."https://github.com/mozilla/midir.git"]
23 git = "https://github.com/mozilla/midir.git"
24 replace-with = "vendored-sources"
25 rev = "4c11f0ffb5d6a10de4aff40a7b81218b33b94e6f"
27 [source."https://github.com/mozilla/cubeb-pulse-rs"]
28 git = "https://github.com/mozilla/cubeb-pulse-rs"
29 replace-with = "vendored-sources"
30 -rev = "df4dc0288b07b865440f4c7e41ca49ca9ccffc63"
31 +rev = "1f1fe1e08e01a9a534ec7f079702a583a0899ce7"
33 [source."https://github.com/mozilla/cubeb-coreaudio-rs"]
34 git = "https://github.com/mozilla/cubeb-coreaudio-rs"
35 replace-with = "vendored-sources"
36 rev = "44eca95823bb57e964cf7b6d9791ed2ccb4b2108"
38 [source."https://github.com/mozilla/audioipc"]
39 git = "https://github.com/mozilla/audioipc"
40 diff --git a/Cargo.lock b/Cargo.lock
43 @@ -1157,17 +1157,17 @@ dependencies = [
52 -source = "git+https://github.com/mozilla/cubeb-pulse-rs?rev=df4dc0288b07b865440f4c7e41ca49ca9ccffc63#df4dc0288b07b865440f4c7e41ca49ca9ccffc63"
53 +source = "git+https://github.com/mozilla/cubeb-pulse-rs?rev=1f1fe1e08e01a9a534ec7f079702a583a0899ce7#1f1fe1e08e01a9a534ec7f079702a583a0899ce7"
62 @@ -3399,17 +3399,17 @@ dependencies = [
72 +version = "0.5.0-alpha"
81 @@ -4122,26 +4122,26 @@ dependencies = [
90 -source = "git+https://github.com/mozilla/cubeb-pulse-rs?rev=df4dc0288b07b865440f4c7e41ca49ca9ccffc63#df4dc0288b07b865440f4c7e41ca49ca9ccffc63"
91 +source = "git+https://github.com/mozilla/cubeb-pulse-rs?rev=1f1fe1e08e01a9a534ec7f079702a583a0899ce7#1f1fe1e08e01a9a534ec7f079702a583a0899ce7"
100 -source = "git+https://github.com/mozilla/cubeb-pulse-rs?rev=df4dc0288b07b865440f4c7e41ca49ca9ccffc63#df4dc0288b07b865440f4c7e41ca49ca9ccffc63"
101 +source = "git+https://github.com/mozilla/cubeb-pulse-rs?rev=1f1fe1e08e01a9a534ec7f079702a583a0899ce7#1f1fe1e08e01a9a534ec7f079702a583a0899ce7"
110 @@ -4456,19 +4456,19 @@ checksum = "7ef03e0a2b150c7a90d01faf6254
114 source = "registry+https://github.com/rust-lang/crates.io-index"
115 checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
118 name = "rustc_version"
120 -source = "registry+https://github.com/rust-lang/crates.io-index"
121 -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
123 +source = "registry+https://github.com/rust-lang/crates.io-index"
124 +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
132 source = "registry+https://github.com/rust-lang/crates.io-index"
133 @@ -4544,28 +4544,19 @@ dependencies = [
137 source = "registry+https://github.com/rust-lang/crates.io-index"
138 checksum = "1ef965a420fe14fdac7dd018862966a4c14094f900e1650bbc71ddd7d580c8af"
143 -source = "registry+https://github.com/rust-lang/crates.io-index"
144 -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
150 -name = "semver-parser"
152 -source = "registry+https://github.com/rust-lang/crates.io-index"
153 -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
155 +source = "registry+https://github.com/rust-lang/crates.io-index"
156 +checksum = "8cb243bdfdb5936c8dc3c45762a19d12ab4550cdc753bc247637d4ec35a040fd"
161 source = "registry+https://github.com/rust-lang/crates.io-index"
162 checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789"
165 diff --git a/gfx/qcms/Cargo.toml b/gfx/qcms/Cargo.toml
166 --- a/gfx/qcms/Cargo.toml
167 +++ b/gfx/qcms/Cargo.toml
168 @@ -17,9 +17,9 @@ c_bindings = ["libc"]
174 libc = {version = "0.2", optional = true }
177 -rustc_version = "0.2"
178 +rustc_version = "0.4"
179 diff --git a/mozglue/static/rust/Cargo.toml b/mozglue/static/rust/Cargo.toml
180 --- a/mozglue/static/rust/Cargo.toml
181 +++ b/mozglue/static/rust/Cargo.toml
182 @@ -8,12 +8,12 @@ license = "MPL"
191 -rustc_version = "0.2"
192 +rustc_version = "0.4"
196 diff --git a/testing/geckodriver/Cargo.toml b/testing/geckodriver/Cargo.toml
197 --- a/testing/geckodriver/Cargo.toml
198 +++ b/testing/geckodriver/Cargo.toml
199 @@ -15,17 +15,17 @@ chrono = "0.4.6"
200 clap = { version = "3.1", default-features = false, features = ["cargo", "std", "suggestions", "wrap_help"] }
203 log = { version = "0.4", features = ["std"] }
204 marionette = { path = "./marionette", version="0.2.0" }
205 mozdevice = { path = "../mozbase/rust/mozdevice", version="0.5.0" }
206 mozprofile = { path = "../mozbase/rust/mozprofile", version="0.8.0" }
207 mozrunner = { path = "../mozbase/rust/mozrunner", version="0.14.0" }
208 -mozversion = { path = "../mozbase/rust/mozversion", version="0.4.3" }
209 +mozversion = { path = "../mozbase/rust/mozversion", version="0.5.0-alpha" }
210 regex = { version="1.0", default-features = false, features = ["perf", "std"] }
217 uuid = { version = "0.8", features = ["v4"] }
218 diff --git a/testing/mozbase/rust/mozversion/Cargo.toml b/testing/mozbase/rust/mozversion/Cargo.toml
219 --- a/testing/mozbase/rust/mozversion/Cargo.toml
220 +++ b/testing/mozbase/rust/mozversion/Cargo.toml
225 +version = "0.5.0-alpha"
226 authors = ["Mozilla"]
227 description = "Utility for accessing Firefox version metadata"
228 keywords = ["mozilla", "firefox"]
229 repository = "https://hg.mozilla.org/mozilla-central/file/tip/testing/mozbase/rust/mozversion"
234 regex = { version = "1", default-features = false, features = ["perf", "std"] }
238 diff --git a/testing/mozbase/rust/mozversion/src/lib.rs b/testing/mozbase/rust/mozversion/src/lib.rs
239 --- a/testing/mozbase/rust/mozversion/src/lib.rs
240 +++ b/testing/mozbase/rust/mozversion/src/lib.rs
241 @@ -101,18 +101,18 @@ impl Version {
242 // The way the semver crate handles prereleases isn't what we want here
243 // This should be fixed in the long term by implementing our own comparison
244 // operators, but for now just act as if prerelease metadata was missing,
245 // otherwise it is almost impossible to use this with nightly
252 + pre: semver::Prerelease::EMPTY,
253 + build: semver::BuildMetadata::EMPTY,
257 pub fn matches(&self, version_req: &str) -> VersionResult<bool> {
258 let req = semver::VersionReq::parse(version_req)?;
259 Ok(req.matches(&self.to_semver()))
262 @@ -269,17 +269,17 @@ fn parse_binary_version(version_str: &st
264 #[derive(Clone, Debug)]
266 /// Error parsing a version string
267 VersionError(String),
268 /// Error reading application metadata
269 MetadataError(String),
270 /// Error processing a string as a semver comparator
271 - SemVerError(semver::ReqParseError),
272 + SemVerError(String),
275 impl Display for Error {
276 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
278 Error::VersionError(ref x) => {
279 "VersionError: ".fmt(f)?;
281 @@ -291,28 +291,25 @@ impl Display for Error {
282 Error::SemVerError(ref e) => {
283 "SemVerError: ".fmt(f)?;
290 -impl From<semver::ReqParseError> for Error {
291 - fn from(err: semver::ReqParseError) -> Error {
292 - Error::SemVerError(err)
293 +impl From<semver::Error> for Error {
294 + fn from(err: semver::Error) -> Error {
295 + Error::SemVerError(err.to_string())
299 impl error::Error for Error {
300 fn cause(&self) -> Option<&dyn error::Error> {
302 - Error::SemVerError(ref e) => Some(e),
303 - Error::VersionError(_) | Error::MetadataError(_) => None,
309 pub type VersionResult<T> = Result<T, Error>;
311 #[cfg(target_os = "macos")]
313 use std::path::{Path, PathBuf};
314 diff --git a/third_party/rust/cubeb-pulse/.cargo-checksum.json b/third_party/rust/cubeb-pulse/.cargo-checksum.json
315 --- a/third_party/rust/cubeb-pulse/.cargo-checksum.json
316 +++ b/third_party/rust/cubeb-pulse/.cargo-checksum.json
318 -{"files":{".editorconfig":"bf047bd1da10cabb99eea666d1e57c321eba4716dccb3e4ed0e2c5fe3ca53858",".github/workflows/build.yml":"95d0d2542c04f0c932f58591b92c3051db5c95657bf5f24b6a6110f7b667568d","AUTHORS":"0e0ac930a68ce2f6b876126b195add177f0d3886facb9260f4d9b69f1988f0cc","Cargo.toml":"d8f84d114794b79a02c8d93724951a0b924f4815e446d666e66877c7a90d0446","LICENSE":"44c6b5ae5ec3fe2fbc608b00e6f4896f4d2d5c7e525fcbaa3eaa3cf2f3d5a983","README.md":"0079450bb4b013bac065ed1750851e461a3710ebad1f323817da1cb82db0bc4f","src/backend/context.rs":"839fbbd90e501c9e455e6b46729f8c3cc03b368b6b45d02c82399660b7cf8289","src/backend/cork_state.rs":"4a0f1afc7d9f333dac89218cc56d7d32fbffb487cd48c1c9a4e03d79cb3b5e28","src/backend/intern.rs":"11ca424e4eb77f8eb9fd5a6717d1e791facf9743156a8534f0016fcf64d57b0f","src/backend/mod.rs":"d5da05348bf1a7f65c85b14372964a49dc4849f0aee96c75e2c18b51fb03fcaf","src/backend/stream.rs":"525e1f6be1990deef3c42d34fc4e25947be642ce242514f8e3428737146cc755","src/capi.rs":"fa0fa020f0d0efe55aa0fc3596405e8407bbe2cbe6c7a558345304e6da87994e","src/lib.rs":"b41bbdc562cbfb130ed7c1e53fe69944774f515705341d8ce48a2f82c8c0c2c5"},"package":null}
319 \ No newline at end of file
320 +{"files":{".editorconfig":"bf047bd1da10cabb99eea666d1e57c321eba4716dccb3e4ed0e2c5fe3ca53858",".github/workflows/build.yml":"95d0d2542c04f0c932f58591b92c3051db5c95657bf5f24b6a6110f7b667568d","AUTHORS":"0e0ac930a68ce2f6b876126b195add177f0d3886facb9260f4d9b69f1988f0cc","Cargo.toml":"13fe95ad27f37b8423958d78093ecff3ade9fffb28c5980604b624c2b617e5a7","LICENSE":"44c6b5ae5ec3fe2fbc608b00e6f4896f4d2d5c7e525fcbaa3eaa3cf2f3d5a983","README.md":"0079450bb4b013bac065ed1750851e461a3710ebad1f323817da1cb82db0bc4f","src/backend/context.rs":"839fbbd90e501c9e455e6b46729f8c3cc03b368b6b45d02c82399660b7cf8289","src/backend/cork_state.rs":"4a0f1afc7d9f333dac89218cc56d7d32fbffb487cd48c1c9a4e03d79cb3b5e28","src/backend/intern.rs":"11ca424e4eb77f8eb9fd5a6717d1e791facf9743156a8534f0016fcf64d57b0f","src/backend/mod.rs":"d5da05348bf1a7f65c85b14372964a49dc4849f0aee96c75e2c18b51fb03fcaf","src/backend/stream.rs":"e88a04ab7094b9df1bcdd07628369ec70ecb2062b91b0bd86f2642962814405c","src/capi.rs":"fa0fa020f0d0efe55aa0fc3596405e8407bbe2cbe6c7a558345304e6da87994e","src/lib.rs":"b41bbdc562cbfb130ed7c1e53fe69944774f515705341d8ce48a2f82c8c0c2c5"},"package":null}
321 \ No newline at end of file
322 diff --git a/third_party/rust/cubeb-pulse/Cargo.toml b/third_party/rust/cubeb-pulse/Cargo.toml
323 --- a/third_party/rust/cubeb-pulse/Cargo.toml
324 +++ b/third_party/rust/cubeb-pulse/Cargo.toml
325 @@ -10,10 +10,10 @@ pulse-dlopen = ["pulse-ffi/dlopen"]
328 crate-type = ["staticlib", "rlib"]
331 cubeb-backend = "0.10"
332 pulse-ffi = { path = "pulse-ffi" }
333 pulse = { path = "pulse-rs" }
337 diff --git a/third_party/rust/cubeb-pulse/src/backend/stream.rs b/third_party/rust/cubeb-pulse/src/backend/stream.rs
338 --- a/third_party/rust/cubeb-pulse/src/backend/stream.rs
339 +++ b/third_party/rust/cubeb-pulse/src/backend/stream.rs
340 @@ -350,16 +350,25 @@ impl<'ctx> PulseStream<'ctx> {
342 read_frames as c_long,
346 if got < 0 || got as usize != read_frames {
347 let _ = s.cancel_write();
351 + stm.state_callback.unwrap()(
352 + stm as *mut _ as *mut _,
354 + ffi::CUBEB_STATE_ERROR,
366 @@ -1064,16 +1073,23 @@ impl<'ctx> PulseStream<'ctx> {
367 read_ptr as *const _ as *mut _,
369 (size / frame_size) as c_long,
373 let _ = stm.cancel_write();
374 self.shutdown = true;
376 + self.state_callback.unwrap()(
377 + self as *const _ as *mut _,
379 + ffi::CUBEB_STATE_ERROR,
385 // If more iterations move offset of read buffer
386 if !input_data.is_null() {
387 let in_frame_size = self.input_sample_spec.frame_size();
388 read_offset += (size / frame_size) * in_frame_size;
390 diff --git a/third_party/rust/rustc_version/.cargo-checksum.json b/third_party/rust/rustc_version/.cargo-checksum.json
391 --- a/third_party/rust/rustc_version/.cargo-checksum.json
392 +++ b/third_party/rust/rustc_version/.cargo-checksum.json
394 -{"files":{"Cargo.toml":"80b9fb136c8c2945b4875b05b0f5a4b11e4722997e751f17d8d3f241d7c684db","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"c9a75f18b9ab2927829a208fc6aa2cf4e63b8420887ba29cdb265d6619ae82d5","README.md":"58bd14a1dfa1d828e6e99f35c3b7c2149d08e2d990d6ca93f92ab8ffb43275b7","src/errors.rs":"b28c2eeb1278fc3e8d68a64b177034faed67f6762335729d3a6d1e61be8fb034","src/lib.rs":"92a32673f77961724bc52b872781f06d22d166f06838c9582c5adae3c5214f51"},"package":"138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"}
395 \ No newline at end of file
396 +{"files":{"Cargo.toml":"6a2e927f37b4897e75470e62face13eff0fe846c57f8fcfb98bcd5e0fe8ed0a2","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"c9a75f18b9ab2927829a208fc6aa2cf4e63b8420887ba29cdb265d6619ae82d5","README.md":"40f1138d4ddcfcfd0534429cea8dcbdcaf4a175aca1c26662f011f6e83d2fd7a","deny.toml":"22979f2da49546b27a5c892d5216bf74215987810a2d011b58870471883b9437","src/lib.rs":"bc18589948e3c04c3ffb491ffc3d4eccd8037c8e377d0bbae8aca2b21978b1de","tests/all.rs":"7b2969022feab85a948fafd331d9bb30d80357d01afaf7e0f723908e75f39e89"},"package":"bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"}
397 \ No newline at end of file
398 diff --git a/third_party/rust/rustc_version/Cargo.toml b/third_party/rust/rustc_version/Cargo.toml
399 --- a/third_party/rust/rustc_version/Cargo.toml
400 +++ b/third_party/rust/rustc_version/Cargo.toml
402 # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
404 # When uploading crates to the registry Cargo will automatically
405 # "normalize" Cargo.toml files for maximal compatibility
406 # with all versions of Cargo and also rewrite `path` dependencies
407 -# to registry (e.g. crates.io) dependencies
408 +# to registry (e.g., crates.io) dependencies
410 # If you believe there's an error in this file please file an
411 # issue against the rust-lang/cargo repository. If you're
412 # editing this file be aware that the upstream Cargo.toml
413 # will likely look very different (and much more reasonable)
417 name = "rustc_version"
419 -authors = ["Marvin Löbel <loebel.marvin@gmail.com>"]
421 +authors = ["Dirkjan Ochtman <dirkjan@ochtman.nl>", "Marvin Löbel <loebel.marvin@gmail.com>"]
422 description = "A library for querying the version of a installed rustc compiler"
423 documentation = "https://docs.rs/rustc_version/"
425 keywords = ["version", "rustc"]
426 license = "MIT/Apache-2.0"
427 repository = "https://github.com/Kimundi/rustc-version-rs"
428 [dependencies.semver]
431 -repository = "Kimundi/rustc-version-rs"
433 +[dev-dependencies.doc-comment]
435 diff --git a/third_party/rust/rustc_version/README.md b/third_party/rust/rustc_version/README.md
436 --- a/third_party/rust/rustc_version/README.md
437 +++ b/third_party/rust/rustc_version/README.md
443 +[![Documentation](https://docs.rs/rustc_version/badge.svg)](https://docs.rs/rustc_version/)
444 +[![Crates.io](https://img.shields.io/crates/v/rustc_version.svg)](https://crates.io/crates/rustc_version)
445 +[![Build status](https://github.com/Kimundi/rustc-version-rs/workflows/CI/badge.svg)](https://github.com/Kimundi/rustc-version-rs/actions?query=workflow%3ACI)
447 A library for querying the version of a `rustc` compiler.
449 This can be used by build scripts or other tools dealing with Rust sources
450 -to make decisions based on the version of the compiler.
451 +to make decisions based on the version of the compiler. Current MSRV is 1.32.0.
453 -[![Travis-CI Status](https://travis-ci.org/Kimundi/rustc-version-rs.png?branch=master)](https://travis-ci.org/Kimundi/rustc-version-rs)
454 +If this is of interest, also consider looking at these other crates:
456 +* [autocfg](https://crates.io/crates/autocfg/), which helps with feature detection instead of depending on compiler versions
457 +* [rustversion](https://github.com/dtolnay/rustversion) provides a procedural macro with no other dependencies
461 [rustc-version-rs is available on crates.io](https://crates.io/crates/rustc_version).
462 It is recommended to look there for the newest released version, as well as links to the newest builds of the docs.
464 At the point of the last update of this README, the latest published version could be used like this:
466 Add the following dependency to your Cargo manifest...
470 rustc_version = "0.2"
473 -...and see the [docs](http://kimundi.github.io/rustc-version-rs/rustc_version/index.html) for how to use it.
474 +... and see the [docs](https://docs.rs/rustc_version) for how to use it.
479 // This could be a cargo build script
481 -extern crate rustc_version;
482 use rustc_version::{version, version_meta, Channel, Version};
485 // Assert we haven't travelled back in time
486 assert!(version().unwrap().major >= 1);
488 // Set cfg flags depending on release channel
489 match version_meta().unwrap().channel {
490 diff --git a/third_party/rust/rustc_version/deny.toml b/third_party/rust/rustc_version/deny.toml
493 +++ b/third_party/rust/rustc_version/deny.toml
496 +allow-osi-fsf-free = "either"
498 diff --git a/third_party/rust/rustc_version/src/errors.rs b/third_party/rust/rustc_version/src/errors.rs
499 deleted file mode 100644
500 --- a/third_party/rust/rustc_version/src/errors.rs
503 -use std::{self, error, fmt, io, str};
504 -use semver::{self, Identifier};
506 -/// The error type for this crate.
509 - /// An error ocurrend when executing the `rustc` command.
510 - CouldNotExecuteCommand(io::Error),
511 - /// The output of `rustc -vV` was not valid utf-8.
512 - Utf8Error(str::Utf8Error),
513 - /// The output of `rustc -vV` was not in the expected format.
514 - UnexpectedVersionFormat,
515 - /// An error ocurred in parsing a `VersionReq`.
516 - ReqParseError(semver::ReqParseError),
517 - /// An error ocurred in parsing the semver.
518 - SemVerError(semver::SemVerError),
519 - /// The pre-release tag is unknown.
520 - UnknownPreReleaseTag(Identifier),
524 -impl fmt::Display for Error {
525 - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
526 - use std::error::Error;
528 - CouldNotExecuteCommand(ref e) => write!(f, "{}: {}", self.description(), e),
529 - Utf8Error(_) => write!(f, "{}", self.description()),
530 - UnexpectedVersionFormat => write!(f, "{}", self.description()),
531 - ReqParseError(ref e) => write!(f, "{}: {}", self.description(), e),
532 - SemVerError(ref e) => write!(f, "{}: {}", self.description(), e),
533 - UnknownPreReleaseTag(ref i) => write!(f, "{}: {}", self.description(), i),
538 -impl error::Error for Error {
539 - fn cause(&self) -> Option<&error::Error> {
541 - CouldNotExecuteCommand(ref e) => Some(e),
542 - Utf8Error(ref e) => Some(e),
543 - UnexpectedVersionFormat => None,
544 - ReqParseError(ref e) => Some(e),
545 - SemVerError(ref e) => Some(e),
546 - UnknownPreReleaseTag(_) => None,
550 - fn description(&self) -> &str {
552 - CouldNotExecuteCommand(_) => "could not execute command",
553 - Utf8Error(_) => "invalid UTF-8 output from `rustc -vV`",
554 - UnexpectedVersionFormat => "unexpected `rustc -vV` format",
555 - ReqParseError(_) => "error parsing version requirement",
556 - SemVerError(_) => "error parsing version",
557 - UnknownPreReleaseTag(_) => "unknown pre-release tag",
562 -macro_rules! impl_from {
563 - ($($err_ty:ty => $variant:ident),* $(,)*) => {
565 - impl From<$err_ty> for Error {
566 - fn from(e: $err_ty) -> Error {
575 - str::Utf8Error => Utf8Error,
576 - semver::SemVerError => SemVerError,
577 - semver::ReqParseError => ReqParseError,
580 -/// The result type for this crate.
581 -pub type Result<T> = std::result::Result<T, Error>;
582 diff --git a/third_party/rust/rustc_version/src/lib.rs b/third_party/rust/rustc_version/src/lib.rs
583 --- a/third_party/rust/rustc_version/src/lib.rs
584 +++ b/third_party/rust/rustc_version/src/lib.rs
586 //! It calls `$RUSTC --version -v` and parses the output, falling
587 //! back to `rustc` if `$RUSTC` is not set.
592 //! // This could be a cargo build script
594 -//! extern crate rustc_version;
595 //! use rustc_version::{version, version_meta, Channel, Version};
598 -//! // Assert we haven't travelled back in time
599 -//! assert!(version().unwrap().major >= 1);
600 +//! // Assert we haven't travelled back in time
601 +//! assert!(version().unwrap().major >= 1);
603 -//! // Set cfg flags depending on release channel
604 -//! match version_meta().unwrap().channel {
605 -//! Channel::Stable => {
606 -//! println!("cargo:rustc-cfg=RUSTC_IS_STABLE");
608 -//! Channel::Beta => {
609 -//! println!("cargo:rustc-cfg=RUSTC_IS_BETA");
611 -//! Channel::Nightly => {
612 -//! println!("cargo:rustc-cfg=RUSTC_IS_NIGHTLY");
614 -//! Channel::Dev => {
615 -//! println!("cargo:rustc-cfg=RUSTC_IS_DEV");
617 +//! // Set cfg flags depending on release channel
618 +//! match version_meta().unwrap().channel {
619 +//! Channel::Stable => {
620 +//! println!("cargo:rustc-cfg=RUSTC_IS_STABLE");
622 +//! Channel::Beta => {
623 +//! println!("cargo:rustc-cfg=RUSTC_IS_BETA");
625 +//! Channel::Nightly => {
626 +//! println!("cargo:rustc-cfg=RUSTC_IS_NIGHTLY");
628 +//! Channel::Dev => {
629 +//! println!("cargo:rustc-cfg=RUSTC_IS_DEV");
633 -//! // Check for a minimum version
634 -//! if version().unwrap() >= Version::parse("1.4.0").unwrap() {
635 -//! println!("cargo:rustc-cfg=compiler_has_important_bugfix");
637 +//! // Check for a minimum version
638 +//! if version().unwrap() >= Version::parse("1.4.0").unwrap() {
639 +//! println!("cargo:rustc-cfg=compiler_has_important_bugfix");
643 -extern crate semver;
644 -use semver::Identifier;
647 +extern crate doc_comment;
650 +doctest!("../README.md");
652 +use std::collections::HashMap;
653 use std::process::Command;
654 -use std::{env, str};
655 -use std::ffi::OsString;
656 +use std::{env, error, fmt, io, num, str};
657 +use std::{ffi::OsString, str::FromStr};
659 // Convenience re-export to allow version comparison without needing to add
661 pub use semver::Version;
664 -pub use errors::{Error, Result};
667 /// Release channel of the compiler.
668 #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
670 /// Development release channel
672 /// Nightly release channel
674 /// Beta release channel
676 /// Stable release channel
680 -/// Rustc version plus metada like git short hash and build date.
683 +/// LLVM's version numbering scheme is not semver compatible until version 4.0
685 +/// rustc [just prints the major and minor versions], so other parts of the version are not included.
687 +/// [just prints the major and minor versions]: https://github.com/rust-lang/rust/blob/b5c9e2448c9ace53ad5c11585803894651b18b0a/compiler/rustc_codegen_llvm/src/llvm_util.rs#L173-L178
688 +#[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
689 +pub struct LlvmVersion {
690 + // fields must be ordered major, minor for comparison to be correct
695 + // TODO: expose micro version here
698 +impl fmt::Display for LlvmVersion {
699 + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
700 + write!(f, "{}.{}", self.major, self.minor)
704 +impl FromStr for LlvmVersion {
705 + type Err = LlvmVersionParseError;
707 + fn from_str(s: &str) -> Result<Self, Self::Err> {
710 + .map(|part| -> Result<u64, LlvmVersionParseError> {
713 + } else if part.starts_with('0') {
714 + Err(LlvmVersionParseError::ComponentMustNotHaveLeadingZeros)
715 + } else if part.starts_with('-') || part.starts_with('+') {
716 + Err(LlvmVersionParseError::ComponentMustNotHaveSign)
722 + let major = parts.next().unwrap()?;
725 + if let Some(part) = parts.next() {
727 + } else if major < 4 {
728 + // LLVM versions earlier than 4.0 have significant minor versions, so require the minor version in this case.
729 + return Err(LlvmVersionParseError::MinorVersionRequiredBefore4);
732 + if let Some(Err(e)) = parts.next() {
736 + if parts.next().is_some() {
737 + return Err(LlvmVersionParseError::TooManyComponents);
740 + Ok(Self { major, minor })
744 +/// Rustc version plus metadata like git short hash and build date.
745 #[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
746 pub struct VersionMeta {
747 /// Version of the compiler
750 /// Git short hash of the build of the compiler
751 pub commit_hash: Option<String>,
753 @@ -96,27 +161,37 @@ pub struct VersionMeta {
754 /// Release channel of the compiler
755 pub channel: Channel,
757 /// Host target triple of the compiler
760 /// Short version string of the compiler
761 pub short_version_string: String,
763 + /// Version of LLVM used by the compiler
764 + pub llvm_version: Option<LlvmVersion>,
768 /// Returns the version metadata for `cmd`, which should be a `rustc` command.
769 - pub fn for_command(cmd: Command) -> Result<VersionMeta> {
771 + pub fn for_command(mut cmd: Command) -> Result<VersionMeta> {
775 + .map_err(Error::CouldNotExecuteCommand)?;
777 - let out = cmd.arg("-vV").output().map_err(Error::CouldNotExecuteCommand)?;
778 - let out = str::from_utf8(&out.stdout)?;
779 + if !out.status.success() {
780 + return Err(Error::CommandError {
781 + stdout: String::from_utf8_lossy(&out.stdout).into(),
782 + stderr: String::from_utf8_lossy(&out.stderr).into(),
786 - version_meta_for(out)
787 + version_meta_for(str::from_utf8(&out.stdout)?)
791 /// Returns the `rustc` SemVer version.
792 pub fn version() -> Result<Version> {
793 Ok(version_meta()?.semver)
796 @@ -127,221 +202,216 @@ pub fn version_meta() -> Result<VersionM
798 VersionMeta::for_command(Command::new(cmd))
801 /// Parses a "rustc -vV" output string and returns
802 /// the SemVer version and additional metadata
803 /// like the git short hash and build date.
804 pub fn version_meta_for(verbose_version_string: &str) -> Result<VersionMeta> {
805 - let out: Vec<_> = verbose_version_string.lines().collect();
807 - if !(out.len() >= 6 && out.len() <= 8) {
808 - return Err(Error::UnexpectedVersionFormat);
810 + let mut map = HashMap::new();
811 + for (i, line) in verbose_version_string.lines().enumerate() {
813 + map.insert("short", line);
817 - let short_version_string = out[0];
818 + let mut parts = line.splitn(2, ": ");
819 + let key = match parts.next() {
824 - fn expect_prefix<'a>(line: &'a str, prefix: &str) -> Result<&'a str> {
825 - if line.starts_with(prefix) {
826 - Ok(&line[prefix.len()..])
828 - Err(Error::UnexpectedVersionFormat)
829 + if let Some(value) = parts.next() {
830 + map.insert(key, value);
834 - let commit_hash = match expect_prefix(out[2], "commit-hash: ")? {
836 - hash => Some(hash.to_owned()),
838 + let short_version_string = expect_key("short", &map)?;
839 + let host = expect_key("host", &map)?;
840 + let release = expect_key("release", &map)?;
841 + let semver: Version = release.parse()?;
843 - let commit_date = match expect_prefix(out[3], "commit-date: ")? {
845 - hash => Some(hash.to_owned()),
846 + let channel = match semver.pre.split('.').next().unwrap() {
847 + "" => Channel::Stable,
848 + "dev" => Channel::Dev,
849 + "beta" => Channel::Beta,
850 + "nightly" => Channel::Nightly,
851 + x => return Err(Error::UnknownPreReleaseTag(x.to_owned())),
854 - // Handle that the build date may or may not be present.
856 - let mut build_date = None;
857 - if out[idx].starts_with("build-date") {
858 - build_date = match expect_prefix(out[idx], "build-date: ")? {
860 - s => Some(s.to_owned()),
865 - let host = expect_prefix(out[idx], "host: ")?;
867 - let release = expect_prefix(out[idx], "release: ")?;
869 - let semver: Version = release.parse()?;
871 - let channel = if semver.pre.is_empty() {
874 - match semver.pre[0] {
875 - Identifier::AlphaNumeric(ref s) if s == "dev" => Channel::Dev,
876 - Identifier::AlphaNumeric(ref s) if s == "beta" => Channel::Beta,
877 - Identifier::AlphaNumeric(ref s) if s == "nightly" => Channel::Nightly,
878 - ref x => return Err(Error::UnknownPreReleaseTag(x.clone())),
880 + let commit_hash = expect_key_or_unknown("commit-hash", &map)?;
881 + let commit_date = expect_key_or_unknown("commit-date", &map)?;
882 + let build_date = map
884 + .filter(|&v| *v != "unknown")
885 + .map(|&v| String::from(v));
886 + let llvm_version = match map.get("LLVM version") {
887 + Some(&v) => Some(v.parse()?),
893 - commit_hash: commit_hash,
894 - commit_date: commit_date,
895 - build_date: build_date,
898 - short_version_string: short_version_string.into(),
905 + short_version_string,
912 - let v = version().unwrap();
913 - assert!(v.major >= 1);
914 +fn expect_key_or_unknown(key: &str, map: &HashMap<&str, &str>) -> Result<Option<String>, Error> {
915 + match map.get(key) {
916 + Some(&v) if v == "unknown" => Ok(None),
917 + Some(&v) => Ok(Some(String::from(v))),
918 + None => Err(Error::UnexpectedVersionFormat),
922 - let v = version_meta().unwrap();
923 - assert!(v.semver.major >= 1);
925 - assert!(version().unwrap() >= Version::parse("1.0.0").unwrap());
926 +fn expect_key(key: &str, map: &HashMap<&str, &str>) -> Result<String, Error> {
928 + .map(|&v| String::from(v))
929 + .ok_or(Error::UnexpectedVersionFormat)
933 -fn parse_unexpected() {
934 - let res = version_meta_for(
935 -"rustc 1.0.0 (a59de37e9 2015-05-13) (built 2015-05-14)
937 -commit-hash: a59de37e99060162a2674e3ff45409ac73595c0e
938 -commit-date: 2015-05-13
939 -rust-birthday: 2015-05-14
940 -host: x86_64-unknown-linux-gnu
942 +/// LLVM Version Parse Error
944 +pub enum LlvmVersionParseError {
945 + /// An error occurred in parsing a version component as an integer
946 + ParseIntError(num::ParseIntError),
947 + /// A version component must not have leading zeros
948 + ComponentMustNotHaveLeadingZeros,
949 + /// A version component has a sign
950 + ComponentMustNotHaveSign,
951 + /// Minor version component must be zero on LLVM versions later than 4.0
952 + MinorVersionMustBeZeroAfter4,
953 + /// Minor version component is required on LLVM versions earlier than 4.0
954 + MinorVersionRequiredBefore4,
955 + /// Too many components
959 - assert!(match res {
960 - Err(Error::UnexpectedVersionFormat) => true,
964 +impl From<num::ParseIntError> for LlvmVersionParseError {
965 + fn from(e: num::ParseIntError) -> Self {
966 + LlvmVersionParseError::ParseIntError(e)
972 - let version = version_meta_for(
973 -"rustc 1.0.0 (a59de37e9 2015-05-13) (built 2015-05-14)
975 -commit-hash: a59de37e99060162a2674e3ff45409ac73595c0e
976 -commit-date: 2015-05-13
977 -build-date: 2015-05-14
978 -host: x86_64-unknown-linux-gnu
979 -release: 1.0.0").unwrap();
981 - assert_eq!(version.semver, Version::parse("1.0.0").unwrap());
982 - assert_eq!(version.commit_hash, Some("a59de37e99060162a2674e3ff45409ac73595c0e".into()));
983 - assert_eq!(version.commit_date, Some("2015-05-13".into()));
984 - assert_eq!(version.build_date, Some("2015-05-14".into()));
985 - assert_eq!(version.channel, Channel::Stable);
986 - assert_eq!(version.host, "x86_64-unknown-linux-gnu");
987 - assert_eq!(version.short_version_string, "rustc 1.0.0 (a59de37e9 2015-05-13) (built 2015-05-14)");
988 +impl fmt::Display for LlvmVersionParseError {
989 + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
991 + LlvmVersionParseError::ParseIntError(e) => {
992 + write!(f, "error parsing LLVM version component: {}", e)
994 + LlvmVersionParseError::ComponentMustNotHaveLeadingZeros => {
995 + write!(f, "a version component must not have leading zeros")
997 + LlvmVersionParseError::ComponentMustNotHaveSign => {
998 + write!(f, "a version component must not have a sign")
1000 + LlvmVersionParseError::MinorVersionMustBeZeroAfter4 => write!(
1002 + "LLVM's minor version component must be 0 for versions greater than 4.0"
1004 + LlvmVersionParseError::MinorVersionRequiredBefore4 => write!(
1006 + "LLVM's minor version component is required for versions less than 4.0"
1008 + LlvmVersionParseError::TooManyComponents => write!(f, "too many version components"),
1015 -fn parse_unknown() {
1016 - let version = version_meta_for(
1019 -commit-hash: unknown
1020 -commit-date: unknown
1021 -host: x86_64-unknown-linux-gnu
1022 -release: 1.3.0").unwrap();
1024 - assert_eq!(version.semver, Version::parse("1.3.0").unwrap());
1025 - assert_eq!(version.commit_hash, None);
1026 - assert_eq!(version.commit_date, None);
1027 - assert_eq!(version.channel, Channel::Stable);
1028 - assert_eq!(version.host, "x86_64-unknown-linux-gnu");
1029 - assert_eq!(version.short_version_string, "rustc 1.3.0");
1030 +impl error::Error for LlvmVersionParseError {
1031 + fn source(&self) -> Option<&(dyn error::Error + 'static)> {
1033 + LlvmVersionParseError::ParseIntError(e) => Some(e),
1034 + LlvmVersionParseError::ComponentMustNotHaveLeadingZeros
1035 + | LlvmVersionParseError::ComponentMustNotHaveSign
1036 + | LlvmVersionParseError::MinorVersionMustBeZeroAfter4
1037 + | LlvmVersionParseError::MinorVersionRequiredBefore4
1038 + | LlvmVersionParseError::TooManyComponents => None,
1044 -fn parse_nightly() {
1045 - let version = version_meta_for(
1046 -"rustc 1.5.0-nightly (65d5c0833 2015-09-29)
1048 -commit-hash: 65d5c083377645a115c4ac23a620d3581b9562b6
1049 -commit-date: 2015-09-29
1050 -host: x86_64-unknown-linux-gnu
1051 -release: 1.5.0-nightly").unwrap();
1053 - assert_eq!(version.semver, Version::parse("1.5.0-nightly").unwrap());
1054 - assert_eq!(version.commit_hash, Some("65d5c083377645a115c4ac23a620d3581b9562b6".into()));
1055 - assert_eq!(version.commit_date, Some("2015-09-29".into()));
1056 - assert_eq!(version.channel, Channel::Nightly);
1057 - assert_eq!(version.host, "x86_64-unknown-linux-gnu");
1058 - assert_eq!(version.short_version_string, "rustc 1.5.0-nightly (65d5c0833 2015-09-29)");
1062 -fn parse_stable() {
1063 - let version = version_meta_for(
1064 -"rustc 1.3.0 (9a92aaf19 2015-09-15)
1066 -commit-hash: 9a92aaf19a64603b02b4130fe52958cc12488900
1067 -commit-date: 2015-09-15
1068 -host: x86_64-unknown-linux-gnu
1069 -release: 1.3.0").unwrap();
1071 - assert_eq!(version.semver, Version::parse("1.3.0").unwrap());
1072 - assert_eq!(version.commit_hash, Some("9a92aaf19a64603b02b4130fe52958cc12488900".into()));
1073 - assert_eq!(version.commit_date, Some("2015-09-15".into()));
1074 - assert_eq!(version.channel, Channel::Stable);
1075 - assert_eq!(version.host, "x86_64-unknown-linux-gnu");
1076 - assert_eq!(version.short_version_string, "rustc 1.3.0 (9a92aaf19 2015-09-15)");
1077 +/// The error type for this crate.
1080 + /// An error occurred while trying to find the `rustc` to run.
1081 + CouldNotExecuteCommand(io::Error),
1082 + /// Error output from the command that was run.
1084 + /// stdout output from the command
1086 + /// stderr output from the command
1089 + /// The output of `rustc -vV` was not valid utf-8.
1090 + Utf8Error(str::Utf8Error),
1091 + /// The output of `rustc -vV` was not in the expected format.
1092 + UnexpectedVersionFormat,
1093 + /// An error occurred in parsing the semver.
1094 + SemVerError(semver::Error),
1095 + /// The pre-release tag is unknown.
1096 + UnknownPreReleaseTag(String),
1097 + /// An error occurred in parsing a `LlvmVersion`.
1098 + LlvmVersionError(LlvmVersionParseError),
1102 -fn parse_1_16_0_nightly() {
1103 - let version = version_meta_for(
1104 -"rustc 1.16.0-nightly (5d994d8b7 2017-01-05)
1106 -commit-hash: 5d994d8b7e482e87467d4a521911477bd8284ce3
1107 -commit-date: 2017-01-05
1108 -host: x86_64-unknown-linux-gnu
1109 -release: 1.16.0-nightly
1110 -LLVM version: 3.9").unwrap();
1112 - assert_eq!(version.semver, Version::parse("1.16.0-nightly").unwrap());
1113 - assert_eq!(version.commit_hash, Some("5d994d8b7e482e87467d4a521911477bd8284ce3".into()));
1114 - assert_eq!(version.commit_date, Some("2017-01-05".into()));
1115 - assert_eq!(version.channel, Channel::Nightly);
1116 - assert_eq!(version.host, "x86_64-unknown-linux-gnu");
1117 - assert_eq!(version.short_version_string, "rustc 1.16.0-nightly (5d994d8b7 2017-01-05)");
1118 +impl fmt::Display for Error {
1119 + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1121 + CouldNotExecuteCommand(ref e) => write!(f, "could not execute command: {}", e),
1127 + "error from command -- stderr:\n\n{}\n\nstderr:\n\n{}",
1130 + Utf8Error(_) => write!(f, "invalid UTF-8 output from `rustc -vV`"),
1131 + UnexpectedVersionFormat => write!(f, "unexpected `rustc -vV` format"),
1132 + SemVerError(ref e) => write!(f, "error parsing version: {}", e),
1133 + UnknownPreReleaseTag(ref i) => write!(f, "unknown pre-release tag: {}", i),
1134 + LlvmVersionError(ref e) => write!(f, "error parsing LLVM's version: {}", e),
1141 -fn version_matches_replacement() {
1142 - let f = |s1: &str, s2: &str| {
1143 - let a = Version::parse(s1).unwrap();
1144 - let b = Version::parse(s2).unwrap();
1145 - println!("{} <= {} : {}", s1, s2, a <= b);
1149 +impl error::Error for Error {
1150 + fn source(&self) -> Option<&(dyn error::Error + 'static)> {
1152 + CouldNotExecuteCommand(ref e) => Some(e),
1153 + CommandError { .. } => None,
1154 + Utf8Error(ref e) => Some(e),
1155 + UnexpectedVersionFormat => None,
1156 + SemVerError(ref e) => Some(e),
1157 + UnknownPreReleaseTag(_) => None,
1158 + LlvmVersionError(ref e) => Some(e),
1163 - f("1.5.0", "1.5.0");
1164 - f("1.5.0-nightly", "1.5.0");
1165 - f("1.5.0", "1.5.0-nightly");
1166 - f("1.5.0-nightly", "1.5.0-nightly");
1167 +macro_rules! impl_from {
1168 + ($($err_ty:ty => $variant:ident),* $(,)*) => {
1170 + impl From<$err_ty> for Error {
1171 + fn from(e: $err_ty) -> Error {
1172 + Error::$variant(e)
1179 - f("1.5.0", "1.6.0");
1180 - f("1.5.0-nightly", "1.6.0");
1181 - f("1.5.0", "1.6.0-nightly");
1182 - f("1.5.0-nightly", "1.6.0-nightly");
1184 + str::Utf8Error => Utf8Error,
1185 + semver::Error => SemVerError,
1186 + LlvmVersionParseError => LlvmVersionError,
1193 +/// The result type for this crate.
1194 +pub type Result<T, E = Error> = std::result::Result<T, E>;
1195 diff --git a/third_party/rust/rustc_version/tests/all.rs b/third_party/rust/rustc_version/tests/all.rs
1196 new file mode 100644
1198 +++ b/third_party/rust/rustc_version/tests/all.rs
1200 +#![allow(clippy::match_like_matches_macro)]
1202 +use std::process::Command;
1204 +use rustc_version::{
1205 + version, version_meta, version_meta_for, Channel, Error, LlvmVersion, LlvmVersionParseError,
1206 + Version, VersionMeta,
1211 + let mut cmd = Command::new("rustc");
1213 + let stderr = match VersionMeta::for_command(cmd) {
1214 + Err(Error::CommandError { stdout: _, stderr }) => stderr,
1215 + _ => panic!("command error expected"),
1217 + assert_eq!(stderr, "error: Unrecognized option: \'FOO\'\n\n");
1222 + let v = version().unwrap();
1223 + assert!(v.major >= 1);
1225 + let v = version_meta().unwrap();
1226 + assert!(v.semver.major >= 1);
1228 + assert!(version().unwrap() >= Version::parse("1.0.0").unwrap());
1233 + let version = version_meta_for(
1234 + "rustc 1.0.0 (a59de37e9 2015-05-13) (built 2015-05-14)
1236 +commit-hash: a59de37e99060162a2674e3ff45409ac73595c0e
1237 +commit-date: 2015-05-13
1238 +build-date: 2015-05-14
1239 +host: x86_64-unknown-linux-gnu
1244 + assert_eq!(version.semver, Version::parse("1.0.0").unwrap());
1246 + version.commit_hash,
1247 + Some("a59de37e99060162a2674e3ff45409ac73595c0e".into())
1249 + assert_eq!(version.commit_date, Some("2015-05-13".into()));
1250 + assert_eq!(version.build_date, Some("2015-05-14".into()));
1251 + assert_eq!(version.channel, Channel::Stable);
1252 + assert_eq!(version.host, "x86_64-unknown-linux-gnu");
1254 + version.short_version_string,
1255 + "rustc 1.0.0 (a59de37e9 2015-05-13) (built 2015-05-14)"
1257 + assert_eq!(version.llvm_version, None);
1261 +fn parse_unknown() {
1262 + let version = version_meta_for(
1265 +commit-hash: unknown
1266 +commit-date: unknown
1267 +host: x86_64-unknown-linux-gnu
1272 + assert_eq!(version.semver, Version::parse("1.3.0").unwrap());
1273 + assert_eq!(version.commit_hash, None);
1274 + assert_eq!(version.commit_date, None);
1275 + assert_eq!(version.channel, Channel::Stable);
1276 + assert_eq!(version.host, "x86_64-unknown-linux-gnu");
1277 + assert_eq!(version.short_version_string, "rustc 1.3.0");
1278 + assert_eq!(version.llvm_version, None);
1282 +fn parse_nightly() {
1283 + let version = version_meta_for(
1284 + "rustc 1.5.0-nightly (65d5c0833 2015-09-29)
1286 +commit-hash: 65d5c083377645a115c4ac23a620d3581b9562b6
1287 +commit-date: 2015-09-29
1288 +host: x86_64-unknown-linux-gnu
1289 +release: 1.5.0-nightly",
1293 + assert_eq!(version.semver, Version::parse("1.5.0-nightly").unwrap());
1295 + version.commit_hash,
1296 + Some("65d5c083377645a115c4ac23a620d3581b9562b6".into())
1298 + assert_eq!(version.commit_date, Some("2015-09-29".into()));
1299 + assert_eq!(version.channel, Channel::Nightly);
1300 + assert_eq!(version.host, "x86_64-unknown-linux-gnu");
1302 + version.short_version_string,
1303 + "rustc 1.5.0-nightly (65d5c0833 2015-09-29)"
1305 + assert_eq!(version.llvm_version, None);
1309 +fn parse_stable() {
1310 + let version = version_meta_for(
1311 + "rustc 1.3.0 (9a92aaf19 2015-09-15)
1313 +commit-hash: 9a92aaf19a64603b02b4130fe52958cc12488900
1314 +commit-date: 2015-09-15
1315 +host: x86_64-unknown-linux-gnu
1320 + assert_eq!(version.semver, Version::parse("1.3.0").unwrap());
1322 + version.commit_hash,
1323 + Some("9a92aaf19a64603b02b4130fe52958cc12488900".into())
1325 + assert_eq!(version.commit_date, Some("2015-09-15".into()));
1326 + assert_eq!(version.channel, Channel::Stable);
1327 + assert_eq!(version.host, "x86_64-unknown-linux-gnu");
1329 + version.short_version_string,
1330 + "rustc 1.3.0 (9a92aaf19 2015-09-15)"
1332 + assert_eq!(version.llvm_version, None);
1336 +fn parse_1_16_0_nightly() {
1337 + let version = version_meta_for(
1338 + "rustc 1.16.0-nightly (5d994d8b7 2017-01-05)
1340 +commit-hash: 5d994d8b7e482e87467d4a521911477bd8284ce3
1341 +commit-date: 2017-01-05
1342 +host: x86_64-unknown-linux-gnu
1343 +release: 1.16.0-nightly
1344 +LLVM version: 3.9",
1348 + assert_eq!(version.semver, Version::parse("1.16.0-nightly").unwrap());
1350 + version.commit_hash,
1351 + Some("5d994d8b7e482e87467d4a521911477bd8284ce3".into())
1353 + assert_eq!(version.commit_date, Some("2017-01-05".into()));
1354 + assert_eq!(version.channel, Channel::Nightly);
1355 + assert_eq!(version.host, "x86_64-unknown-linux-gnu");
1357 + version.short_version_string,
1358 + "rustc 1.16.0-nightly (5d994d8b7 2017-01-05)"
1361 + version.llvm_version,
1362 + Some(LlvmVersion { major: 3, minor: 9 })
1367 +fn parse_1_47_0_stable() {
1368 + let version = version_meta_for(
1369 + "rustc 1.47.0 (18bf6b4f0 2020-10-07)
1371 +commit-hash: 18bf6b4f01a6feaf7259ba7cdae58031af1b7b39
1372 +commit-date: 2020-10-07
1373 +host: powerpc64le-unknown-linux-gnu
1375 +LLVM version: 11.0",
1379 + assert_eq!(version.semver, Version::parse("1.47.0").unwrap());
1381 + version.commit_hash,
1382 + Some("18bf6b4f01a6feaf7259ba7cdae58031af1b7b39".into())
1384 + assert_eq!(version.commit_date, Some("2020-10-07".into()));
1385 + assert_eq!(version.channel, Channel::Stable);
1386 + assert_eq!(version.host, "powerpc64le-unknown-linux-gnu");
1388 + version.short_version_string,
1389 + "rustc 1.47.0 (18bf6b4f0 2020-10-07)"
1392 + version.llvm_version,
1393 + Some(LlvmVersion {
1401 +fn parse_llvm_micro() {
1402 + let version = version_meta_for(
1403 + "rustc 1.51.0-nightly (4253153db 2021-01-17)
1405 +commit-hash: 4253153db205251f72ea4493687a31e04a2a8ca0
1406 +commit-date: 2021-01-17
1407 +host: x86_64-pc-windows-msvc
1408 +release: 1.51.0-nightly
1409 +LLVM version: 11.0.1",
1413 + assert_eq!(version.semver, Version::parse("1.51.0-nightly").unwrap());
1415 + version.commit_hash.unwrap(),
1416 + "4253153db205251f72ea4493687a31e04a2a8ca0"
1418 + assert_eq!(version.commit_date.unwrap(), "2021-01-17");
1419 + assert_eq!(version.host, "x86_64-pc-windows-msvc");
1421 + version.short_version_string,
1422 + "rustc 1.51.0-nightly (4253153db 2021-01-17)"
1425 + version.llvm_version,
1426 + Some(LlvmVersion {
1434 +fn parse_debian_buster() {
1435 + let version = version_meta_for(
1438 +commit-hash: unknown
1439 +commit-date: unknown
1440 +host: powerpc64le-unknown-linux-gnu
1442 +LLVM version: 7.0",
1446 + assert_eq!(version.semver, Version::parse("1.41.1").unwrap());
1447 + assert_eq!(version.commit_hash, None);
1448 + assert_eq!(version.commit_date, None);
1449 + assert_eq!(version.channel, Channel::Stable);
1450 + assert_eq!(version.host, "powerpc64le-unknown-linux-gnu");
1451 + assert_eq!(version.short_version_string, "rustc 1.41.1");
1453 + version.llvm_version,
1454 + Some(LlvmVersion { major: 7, minor: 0 })
1459 +fn parse_termux() {
1460 + let version = version_meta_for(
1463 +commit-hash: unknown
1464 +commit-date: unknown
1465 +host: aarch64-linux-android
1467 +LLVM version: 10.0",
1471 + assert_eq!(version.semver, Version::parse("1.46.0").unwrap());
1472 + assert_eq!(version.commit_hash, None);
1473 + assert_eq!(version.commit_date, None);
1474 + assert_eq!(version.channel, Channel::Stable);
1475 + assert_eq!(version.host, "aarch64-linux-android");
1476 + assert_eq!(version.short_version_string, "rustc 1.46.0");
1478 + version.llvm_version,
1479 + Some(LlvmVersion {
1487 +fn parse_llvm_version_empty() {
1488 + let res: Result<LlvmVersion, _> = "".parse();
1489 + assert!(match res {
1490 + Err(LlvmVersionParseError::ParseIntError(_)) => true,
1496 +fn parse_llvm_version_invalid_char() {
1497 + let res: Result<LlvmVersion, _> = "A".parse();
1498 + assert!(match res {
1499 + Err(LlvmVersionParseError::ParseIntError(_)) => true,
1505 +fn parse_llvm_version_overflow() {
1506 + let res: Result<LlvmVersion, _> = "9999999999999999999999999999999".parse();
1507 + assert!(match res {
1508 + Err(LlvmVersionParseError::ParseIntError(_)) => true,
1514 +fn parse_llvm_version_leading_zero_on_zero() {
1515 + let res: Result<LlvmVersion, _> = "00".parse();
1516 + assert!(match res {
1517 + Err(LlvmVersionParseError::ComponentMustNotHaveLeadingZeros) => true,
1523 +fn parse_llvm_version_leading_zero_on_nonzero() {
1524 + let res: Result<LlvmVersion, _> = "01".parse();
1525 + assert!(match res {
1526 + Err(LlvmVersionParseError::ComponentMustNotHaveLeadingZeros) => true,
1532 +fn parse_llvm_version_4_components() {
1533 + let res: Result<LlvmVersion, _> = "4.0.0.0".parse();
1535 + assert!(match res {
1536 + Err(LlvmVersionParseError::TooManyComponents) => true,
1542 +fn parse_llvm_version_component_sign_plus() {
1543 + let res: Result<LlvmVersion, _> = "1.+3".parse();
1545 + assert!(match res {
1546 + Err(LlvmVersionParseError::ComponentMustNotHaveSign) => true,
1552 +fn parse_llvm_version_component_sign_minus() {
1553 + let res: Result<LlvmVersion, _> = "1.-3".parse();
1555 + assert!(match res {
1556 + Err(LlvmVersionParseError::ComponentMustNotHaveSign) => true,
1562 +fn parse_llvm_version_3() {
1563 + let res: Result<LlvmVersion, _> = "3".parse();
1565 + assert!(match res {
1566 + Err(LlvmVersionParseError::MinorVersionRequiredBefore4) => true,
1572 +fn parse_llvm_version_5() {
1573 + let v: LlvmVersion = "5".parse().unwrap();
1574 + assert_eq!(v, LlvmVersion { major: 5, minor: 0 });
1578 +fn parse_llvm_version_5_0() {
1579 + let v: LlvmVersion = "5.0".parse().unwrap();
1580 + assert_eq!(v, LlvmVersion { major: 5, minor: 0 });
1584 +fn parse_llvm_version_4_0() {
1585 + let v: LlvmVersion = "4.0".parse().unwrap();
1586 + assert_eq!(v, LlvmVersion { major: 4, minor: 0 });
1590 +fn parse_llvm_version_3_0() {
1591 + let v: LlvmVersion = "3.0".parse().unwrap();
1592 + assert_eq!(v, LlvmVersion { major: 3, minor: 0 });
1596 +fn parse_llvm_version_3_9() {
1597 + let v: LlvmVersion = "3.9".parse().unwrap();
1598 + assert_eq!(v, LlvmVersion { major: 3, minor: 9 });
1602 +fn parse_llvm_version_11_0() {
1603 + let v: LlvmVersion = "11.0".parse().unwrap();
1614 +fn parse_llvm_version_11() {
1615 + let v: LlvmVersion = "11".parse().unwrap();
1626 +fn test_llvm_version_comparison() {
1627 + // check that field order is correct
1628 + assert!(LlvmVersion { major: 3, minor: 9 } < LlvmVersion { major: 4, minor: 0 });
1633 +fn version_matches_replacement() {
1634 + let f = |s1: &str, s2: &str| {
1635 + let a = Version::parse(s1).unwrap();
1636 + let b = Version::parse(s2).unwrap();
1637 + println!("{} <= {} : {}", s1, s2, a <= b);
1642 + f("1.5.0", "1.5.0");
1643 + f("1.5.0-nightly", "1.5.0");
1644 + f("1.5.0", "1.5.0-nightly");
1645 + f("1.5.0-nightly", "1.5.0-nightly");
1647 + f("1.5.0", "1.6.0");
1648 + f("1.5.0-nightly", "1.6.0");
1649 + f("1.5.0", "1.6.0-nightly");
1650 + f("1.5.0-nightly", "1.6.0-nightly");
1656 diff --git a/third_party/rust/semver-parser/.cargo-checksum.json b/third_party/rust/semver-parser/.cargo-checksum.json
1657 deleted file mode 100644
1658 --- a/third_party/rust/semver-parser/.cargo-checksum.json
1661 -{"files":{"Cargo.toml":"67597114802114d2a7fdb457c1cf5f7e0c951b21e287c6a47b9a86b9028cf64d","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"d38feaa4f9468cd1e0ece22e0ad2eadfe6195a9a0a3843b7c722d5c7d81804fb","src/common.rs":"dc42336abd34e19ca9f732f33657e106f98dcc8c10d4c2564bc4f160cb31926e","src/lib.rs":"3ac8ef5a280344a25cb18ac386034c0fee8d64060fa14af5e25ed49f0cb2fd9e","src/range.rs":"3596f048d466d43887aff1e8c8c834476672a4627631ed35379c35466b5f02ec","src/recognize.rs":"9f16eda9fcd7d8af7eee4c3b89c611bd648040273fde6b35778f8a50b004c8b1","src/version.rs":"dbd91a4e4fd92a0aa9eb4f858ecbc1ecd680aa60572cc2ad2085e5c5c30e5b77"},"package":"388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"}
1662 \ No newline at end of file
1663 diff --git a/third_party/rust/semver-parser/Cargo.toml b/third_party/rust/semver-parser/Cargo.toml
1664 deleted file mode 100644
1665 --- a/third_party/rust/semver-parser/Cargo.toml
1669 -name = "semver-parser"
1671 -authors = ["Steve Klabnik <steve@steveklabnik.com>"]
1672 -license = "MIT/Apache-2.0"
1673 -repository = "https://github.com/steveklabnik/semver-parser"
1674 -homepage = "https://github.com/steveklabnik/semver-parser"
1675 -documentation = "https://docs.rs/semver-parser"
1677 -Parsing of the semver spec.
1679 diff --git a/third_party/rust/semver-parser/LICENSE-APACHE b/third_party/rust/semver-parser/LICENSE-APACHE
1680 deleted file mode 100644
1681 --- a/third_party/rust/semver-parser/LICENSE-APACHE
1685 - Version 2.0, January 2004
1686 - http://www.apache.org/licenses/
1688 -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1692 - "License" shall mean the terms and conditions for use, reproduction,
1693 - and distribution as defined by Sections 1 through 9 of this document.
1695 - "Licensor" shall mean the copyright owner or entity authorized by
1696 - the copyright owner that is granting the License.
1698 - "Legal Entity" shall mean the union of the acting entity and all
1699 - other entities that control, are controlled by, or are under common
1700 - control with that entity. For the purposes of this definition,
1701 - "control" means (i) the power, direct or indirect, to cause the
1702 - direction or management of such entity, whether by contract or
1703 - otherwise, or (ii) ownership of fifty percent (50%) or more of the
1704 - outstanding shares, or (iii) beneficial ownership of such entity.
1706 - "You" (or "Your") shall mean an individual or Legal Entity
1707 - exercising permissions granted by this License.
1709 - "Source" form shall mean the preferred form for making modifications,
1710 - including but not limited to software source code, documentation
1711 - source, and configuration files.
1713 - "Object" form shall mean any form resulting from mechanical
1714 - transformation or translation of a Source form, including but
1715 - not limited to compiled object code, generated documentation,
1716 - and conversions to other media types.
1718 - "Work" shall mean the work of authorship, whether in Source or
1719 - Object form, made available under the License, as indicated by a
1720 - copyright notice that is included in or attached to the work
1721 - (an example is provided in the Appendix below).
1723 - "Derivative Works" shall mean any work, whether in Source or Object
1724 - form, that is based on (or derived from) the Work and for which the
1725 - editorial revisions, annotations, elaborations, or other modifications
1726 - represent, as a whole, an original work of authorship. For the purposes
1727 - of this License, Derivative Works shall not include works that remain
1728 - separable from, or merely link (or bind by name) to the interfaces of,
1729 - the Work and Derivative Works thereof.
1731 - "Contribution" shall mean any work of authorship, including
1732 - the original version of the Work and any modifications or additions
1733 - to that Work or Derivative Works thereof, that is intentionally
1734 - submitted to Licensor for inclusion in the Work by the copyright owner
1735 - or by an individual or Legal Entity authorized to submit on behalf of
1736 - the copyright owner. For the purposes of this definition, "submitted"
1737 - means any form of electronic, verbal, or written communication sent
1738 - to the Licensor or its representatives, including but not limited to
1739 - communication on electronic mailing lists, source code control systems,
1740 - and issue tracking systems that are managed by, or on behalf of, the
1741 - Licensor for the purpose of discussing and improving the Work, but
1742 - excluding communication that is conspicuously marked or otherwise
1743 - designated in writing by the copyright owner as "Not a Contribution."
1745 - "Contributor" shall mean Licensor and any individual or Legal Entity
1746 - on behalf of whom a Contribution has been received by Licensor and
1747 - subsequently incorporated within the Work.
1749 -2. Grant of Copyright License. Subject to the terms and conditions of
1750 - this License, each Contributor hereby grants to You a perpetual,
1751 - worldwide, non-exclusive, no-charge, royalty-free, irrevocable
1752 - copyright license to reproduce, prepare Derivative Works of,
1753 - publicly display, publicly perform, sublicense, and distribute the
1754 - Work and such Derivative Works in Source or Object form.
1756 -3. Grant of Patent License. Subject to the terms and conditions of
1757 - this License, each Contributor hereby grants to You a perpetual,
1758 - worldwide, non-exclusive, no-charge, royalty-free, irrevocable
1759 - (except as stated in this section) patent license to make, have made,
1760 - use, offer to sell, sell, import, and otherwise transfer the Work,
1761 - where such license applies only to those patent claims licensable
1762 - by such Contributor that are necessarily infringed by their
1763 - Contribution(s) alone or by combination of their Contribution(s)
1764 - with the Work to which such Contribution(s) was submitted. If You
1765 - institute patent litigation against any entity (including a
1766 - cross-claim or counterclaim in a lawsuit) alleging that the Work
1767 - or a Contribution incorporated within the Work constitutes direct
1768 - or contributory patent infringement, then any patent licenses
1769 - granted to You under this License for that Work shall terminate
1770 - as of the date such litigation is filed.
1772 -4. Redistribution. You may reproduce and distribute copies of the
1773 - Work or Derivative Works thereof in any medium, with or without
1774 - modifications, and in Source or Object form, provided that You
1775 - meet the following conditions:
1777 - (a) You must give any other recipients of the Work or
1778 - Derivative Works a copy of this License; and
1780 - (b) You must cause any modified files to carry prominent notices
1781 - stating that You changed the files; and
1783 - (c) You must retain, in the Source form of any Derivative Works
1784 - that You distribute, all copyright, patent, trademark, and
1785 - attribution notices from the Source form of the Work,
1786 - excluding those notices that do not pertain to any part of
1787 - the Derivative Works; and
1789 - (d) If the Work includes a "NOTICE" text file as part of its
1790 - distribution, then any Derivative Works that You distribute must
1791 - include a readable copy of the attribution notices contained
1792 - within such NOTICE file, excluding those notices that do not
1793 - pertain to any part of the Derivative Works, in at least one
1794 - of the following places: within a NOTICE text file distributed
1795 - as part of the Derivative Works; within the Source form or
1796 - documentation, if provided along with the Derivative Works; or,
1797 - within a display generated by the Derivative Works, if and
1798 - wherever such third-party notices normally appear. The contents
1799 - of the NOTICE file are for informational purposes only and
1800 - do not modify the License. You may add Your own attribution
1801 - notices within Derivative Works that You distribute, alongside
1802 - or as an addendum to the NOTICE text from the Work, provided
1803 - that such additional attribution notices cannot be construed
1804 - as modifying the License.
1806 - You may add Your own copyright statement to Your modifications and
1807 - may provide additional or different license terms and conditions
1808 - for use, reproduction, or distribution of Your modifications, or
1809 - for any such Derivative Works as a whole, provided Your use,
1810 - reproduction, and distribution of the Work otherwise complies with
1811 - the conditions stated in this License.
1813 -5. Submission of Contributions. Unless You explicitly state otherwise,
1814 - any Contribution intentionally submitted for inclusion in the Work
1815 - by You to the Licensor shall be under the terms and conditions of
1816 - this License, without any additional terms or conditions.
1817 - Notwithstanding the above, nothing herein shall supersede or modify
1818 - the terms of any separate license agreement you may have executed
1819 - with Licensor regarding such Contributions.
1821 -6. Trademarks. This License does not grant permission to use the trade
1822 - names, trademarks, service marks, or product names of the Licensor,
1823 - except as required for reasonable and customary use in describing the
1824 - origin of the Work and reproducing the content of the NOTICE file.
1826 -7. Disclaimer of Warranty. Unless required by applicable law or
1827 - agreed to in writing, Licensor provides the Work (and each
1828 - Contributor provides its Contributions) on an "AS IS" BASIS,
1829 - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1830 - implied, including, without limitation, any warranties or conditions
1831 - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
1832 - PARTICULAR PURPOSE. You are solely responsible for determining the
1833 - appropriateness of using or redistributing the Work and assume any
1834 - risks associated with Your exercise of permissions under this License.
1836 -8. Limitation of Liability. In no event and under no legal theory,
1837 - whether in tort (including negligence), contract, or otherwise,
1838 - unless required by applicable law (such as deliberate and grossly
1839 - negligent acts) or agreed to in writing, shall any Contributor be
1840 - liable to You for damages, including any direct, indirect, special,
1841 - incidental, or consequential damages of any character arising as a
1842 - result of this License or out of the use or inability to use the
1843 - Work (including but not limited to damages for loss of goodwill,
1844 - work stoppage, computer failure or malfunction, or any and all
1845 - other commercial damages or losses), even if such Contributor
1846 - has been advised of the possibility of such damages.
1848 -9. Accepting Warranty or Additional Liability. While redistributing
1849 - the Work or Derivative Works thereof, You may choose to offer,
1850 - and charge a fee for, acceptance of support, warranty, indemnity,
1851 - or other liability obligations and/or rights consistent with this
1852 - License. However, in accepting such obligations, You may act only
1853 - on Your own behalf and on Your sole responsibility, not on behalf
1854 - of any other Contributor, and only if You agree to indemnify,
1855 - defend, and hold each Contributor harmless for any liability
1856 - incurred by, or claims asserted against, such Contributor by reason
1857 - of your accepting any such warranty or additional liability.
1859 -END OF TERMS AND CONDITIONS
1861 -APPENDIX: How to apply the Apache License to your work.
1863 - To apply the Apache License to your work, attach the following
1864 - boilerplate notice, with the fields enclosed by brackets "[]"
1865 - replaced with your own identifying information. (Don't include
1866 - the brackets!) The text should be enclosed in the appropriate
1867 - comment syntax for the file format. We also recommend that a
1868 - file or class name and description of purpose be included on the
1869 - same "printed page" as the copyright notice for easier
1870 - identification within third-party archives.
1872 -Copyright [yyyy] [name of copyright owner]
1874 -Licensed under the Apache License, Version 2.0 (the "License");
1875 -you may not use this file except in compliance with the License.
1876 -You may obtain a copy of the License at
1878 - http://www.apache.org/licenses/LICENSE-2.0
1880 -Unless required by applicable law or agreed to in writing, software
1881 -distributed under the License is distributed on an "AS IS" BASIS,
1882 -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1883 -See the License for the specific language governing permissions and
1884 -limitations under the License.
1885 diff --git a/third_party/rust/semver-parser/LICENSE-MIT b/third_party/rust/semver-parser/LICENSE-MIT
1886 deleted file mode 100644
1887 --- a/third_party/rust/semver-parser/LICENSE-MIT
1890 -Copyright (c) 2016 Steve Klabnik
1892 -Permission is hereby granted, free of charge, to any
1893 -person obtaining a copy of this software and associated
1894 -documentation files (the "Software"), to deal in the
1895 -Software without restriction, including without
1896 -limitation the rights to use, copy, modify, merge,
1897 -publish, distribute, sublicense, and/or sell copies of
1898 -the Software, and to permit persons to whom the Software
1899 -is furnished to do so, subject to the following
1902 -The above copyright notice and this permission notice
1903 -shall be included in all copies or substantial portions
1906 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
1907 -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
1908 -TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
1909 -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
1910 -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
1911 -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
1912 -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
1913 -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1914 -DEALINGS IN THE SOFTWARE.
1915 diff --git a/third_party/rust/semver-parser/src/common.rs b/third_party/rust/semver-parser/src/common.rs
1916 deleted file mode 100644
1917 --- a/third_party/rust/semver-parser/src/common.rs
1920 -use version::Identifier;
1921 -use recognize::{Recognize, Alt, OneOrMore, Inclusive, OneByte};
1922 -use std::str::from_utf8;
1924 -// by the time we get here, we know that it's all valid characters, so this doesn't need to return
1925 -// a result or anything
1926 -fn parse_meta(s: &str) -> Vec<Identifier> {
1927 - // Originally, I wanted to implement this method via calling parse, but parse is tolerant of
1928 - // leading zeroes, and we want anything with leading zeroes to be considered alphanumeric, not
1929 - // numeric. So the strategy is to check with a recognizer first, and then call parse once
1930 - // we've determined that it's a number without a leading zero.
1933 - // another wrinkle: we made sure that any number starts with a
1934 - // non-zero. But there's a problem: an actual zero is a number, yet
1935 - // gets left out by this heuristic. So let's also check for the
1936 - // single, lone zero.
1937 - if is_alpha_numeric(part) {
1938 - Identifier::AlphaNumeric(part.to_string())
1940 - // we can unwrap here because we know it is only digits due to the regex
1941 - Identifier::Numeric(part.parse().unwrap())
1946 -// parse optional metadata (preceded by the prefix character)
1947 -pub fn parse_optional_meta(s: &[u8], prefix_char: u8)-> Result<(Vec<Identifier>, usize), String> {
1948 - if let Some(len) = prefix_char.p(s) {
1950 - if let Some(len) = letters_numbers_dash_dot(&s[start..]) {
1951 - let end = start + len;
1952 - Ok((parse_meta(from_utf8(&s[start..end]).unwrap()), end))
1954 - Err("Error parsing prerelease".to_string())
1957 - Ok((Vec::new(), 0))
1961 -pub fn is_alpha_numeric(s: &str) -> bool {
1962 - if let Some((_val, len)) = numeric_identifier(s.as_bytes()) {
1963 - // Return true for number with leading zero
1964 - // Note: doing it this way also handily makes overflow fail over.
1971 -// Note: could plumb overflow error up to return value as Result
1972 -pub fn numeric_identifier(s: &[u8]) -> Option<(u64, usize)> {
1973 - if let Some(len) = Alt(b'0', OneOrMore(Inclusive(b'0'..b'9'))).p(s) {
1974 - from_utf8(&s[0..len]).unwrap().parse().ok().map(|val| (val, len))
1980 -pub fn letters_numbers_dash_dot(s: &[u8]) -> Option<usize> {
1981 - OneOrMore(OneByte(|c| c == b'-' || c == b'.' ||
1982 - (b'0' <= c && c <= b'9') ||
1983 - (b'a' <= c && c <= b'z') ||
1984 - (b'A' <= c && c <= b'Z'))).p(s)
1986 diff --git a/third_party/rust/semver-parser/src/lib.rs b/third_party/rust/semver-parser/src/lib.rs
1987 deleted file mode 100644
1988 --- a/third_party/rust/semver-parser/src/lib.rs
1994 -// for private stuff the two share
1997 -// for recognizer combinators
1999 diff --git a/third_party/rust/semver-parser/src/range.rs b/third_party/rust/semver-parser/src/range.rs
2000 deleted file mode 100644
2001 --- a/third_party/rust/semver-parser/src/range.rs
2004 -use common::{self, numeric_identifier, letters_numbers_dash_dot};
2005 -use version::Identifier;
2006 -use std::str::{FromStr, from_utf8};
2010 -pub struct VersionReq {
2011 - pub predicates: Vec<Predicate>,
2014 -#[derive(PartialEq,Debug)]
2015 -pub enum WildcardVersion {
2021 -#[derive(PartialEq,Debug)]
2024 - Gt, // Greater than
2025 - GtEq, // Greater than or equal to
2027 - LtEq, // Less than or equal to
2028 - Tilde, // e.g. ~1.0.0
2029 - Compatible, // compatible by definition of semver, indicated by ^
2030 - Wildcard(WildcardVersion), // x.y.*, x.*, *
2033 -impl FromStr for Op {
2034 - type Err = String;
2036 - fn from_str(s: &str) -> Result<Op, String> {
2038 - "=" => Ok(Op::Ex),
2039 - ">" => Ok(Op::Gt),
2040 - ">=" => Ok(Op::GtEq),
2041 - "<" => Ok(Op::Lt),
2042 - "<=" => Ok(Op::LtEq),
2043 - "~" => Ok(Op::Tilde),
2044 - "^" => Ok(Op::Compatible),
2045 - _ => Err(String::from("Could not parse Op")),
2050 -#[derive(PartialEq,Debug)]
2051 -pub struct Predicate {
2054 - pub minor: Option<u64>,
2055 - pub patch: Option<u64>,
2056 - pub pre: Vec<Identifier>,
2059 -fn numeric_or_wild(s: &[u8]) -> Option<(Option<u64>, usize)> {
2060 - if let Some((val, len)) = numeric_identifier(s) {
2061 - Some((Some(val), len))
2062 - } else if let Some(len) = OneOf(b"*xX").p(s) {
2069 -fn dot_numeric_or_wild(s: &[u8]) -> Option<(Option<u64>, usize)> {
2070 - b'.'.p(s).and_then(|len|
2071 - numeric_or_wild(&s[len..]).map(|(val, len2)| (val, len + len2))
2075 -fn operation(s: &[u8]) -> Option<(Op, usize)> {
2076 - if let Some(len) = "=".p(s) {
2077 - Some((Op::Ex, len))
2078 - } else if let Some(len) = ">=".p(s) {
2079 - Some((Op::GtEq, len))
2080 - } else if let Some(len) = ">".p(s) {
2081 - Some((Op::Gt, len))
2082 - } else if let Some(len) = "<=".p(s) {
2083 - Some((Op::LtEq, len))
2084 - } else if let Some(len) = "<".p(s) {
2085 - Some((Op::Lt, len))
2086 - } else if let Some(len) = "~".p(s) {
2087 - Some((Op::Tilde, len))
2088 - } else if let Some(len) = "^".p(s) {
2089 - Some((Op::Compatible, len))
2095 -fn whitespace(s: &[u8]) -> Option<usize> {
2096 - ZeroOrMore(OneOf(b"\t\r\n ")).p(s)
2099 -pub fn parse_predicate(range: &str) -> Result<Predicate, String> {
2100 - let s = range.trim().as_bytes();
2102 - let mut operation = if let Some((op, len)) = operation(&s[i..]) {
2106 - // operations default to Compatible
2109 - if let Some(len) = whitespace.p(&s[i..]) {
2112 - let major = if let Some((major, len)) = numeric_identifier(&s[i..]) {
2116 - return Err("Error parsing major version number: ".to_string());
2118 - let minor = if let Some((minor, len)) = dot_numeric_or_wild(&s[i..]) {
2120 - if minor.is_none() {
2121 - operation = Op::Wildcard(WildcardVersion::Minor);
2127 - let patch = if let Some((patch, len)) = dot_numeric_or_wild(&s[i..]) {
2129 - if patch.is_none() {
2130 - operation = Op::Wildcard(WildcardVersion::Patch);
2136 - let (pre, pre_len) = common::parse_optional_meta(&s[i..], b'-')?;
2138 - if let Some(len) = (b'+', letters_numbers_dash_dot).p(&s[i..]) {
2142 - return Err("Extra junk after valid predicate: ".to_string() +
2143 - from_utf8(&s[i..]).unwrap());
2154 -pub fn parse(ranges: &str) -> Result<VersionReq, String> {
2155 - // null is an error
2156 - if ranges == "\0" {
2157 - return Err(String::from("Null is not a valid VersionReq"));
2160 - // an empty range is a major version wildcard
2161 - // so is a lone * or x of either capitalization
2163 - || (ranges == "*")
2164 - || (ranges == "x")
2165 - || (ranges == "X") {
2166 - return Ok(VersionReq {
2167 - predicates: vec![Predicate {
2168 - op: Op::Wildcard(WildcardVersion::Major),
2178 - let ranges = ranges.trim();
2180 - let predicates: Result<Vec<_>, String> = ranges
2183 - parse_predicate(range)
2187 - let predicates = try!(predicates);
2189 - if predicates.len() == 0 {
2190 - return Err(String::from("VersionReq did not parse properly"));
2194 - predicates: predicates,
2202 - use version::Identifier;
2205 - fn test_parsing_default() {
2206 - let r = range::parse("1.0.0").unwrap();
2208 - assert_eq!(Predicate {
2209 - op: Op::Compatible,
2220 - fn test_parsing_exact_01() {
2221 - let r = range::parse("=1.0.0").unwrap();
2223 - assert_eq!(Predicate {
2235 - fn test_parsing_exact_02() {
2236 - let r = range::parse("=0.9.0").unwrap();
2238 - assert_eq!(Predicate {
2250 - fn test_parsing_exact_03() {
2251 - let r = range::parse("=0.1.0-beta2.a").unwrap();
2253 - assert_eq!(Predicate {
2258 - pre: vec![Identifier::AlphaNumeric(String::from("beta2")),
2259 - Identifier::AlphaNumeric(String::from("a"))],
2266 - pub fn test_parsing_greater_than() {
2267 - let r = range::parse("> 1.0.0").unwrap();
2269 - assert_eq!(Predicate {
2281 - pub fn test_parsing_greater_than_01() {
2282 - let r = range::parse(">= 1.0.0").unwrap();
2284 - assert_eq!(Predicate {
2296 - pub fn test_parsing_greater_than_02() {
2297 - let r = range::parse(">= 2.1.0-alpha2").unwrap();
2299 - assert_eq!(Predicate {
2304 - pre: vec![Identifier::AlphaNumeric(String::from("alpha2"))],
2311 - pub fn test_parsing_less_than() {
2312 - let r = range::parse("< 1.0.0").unwrap();
2314 - assert_eq!(Predicate {
2326 - pub fn test_parsing_less_than_eq() {
2327 - let r = range::parse("<= 2.1.0-alpha2").unwrap();
2329 - assert_eq!(Predicate {
2334 - pre: vec![Identifier::AlphaNumeric(String::from("alpha2"))],
2341 - pub fn test_parsing_tilde() {
2342 - let r = range::parse("~1").unwrap();
2344 - assert_eq!(Predicate {
2356 - pub fn test_parsing_compatible() {
2357 - let r = range::parse("^0").unwrap();
2359 - assert_eq!(Predicate {
2360 - op: Op::Compatible,
2371 - fn test_parsing_blank() {
2372 - let r = range::parse("").unwrap();
2374 - assert_eq!(Predicate {
2375 - op: Op::Wildcard(WildcardVersion::Major),
2386 - fn test_parsing_wildcard() {
2387 - let r = range::parse("*").unwrap();
2389 - assert_eq!(Predicate {
2390 - op: Op::Wildcard(WildcardVersion::Major),
2401 - fn test_parsing_x() {
2402 - let r = range::parse("x").unwrap();
2404 - assert_eq!(Predicate {
2405 - op: Op::Wildcard(WildcardVersion::Major),
2416 - fn test_parsing_capital_x() {
2417 - let r = range::parse("X").unwrap();
2419 - assert_eq!(Predicate {
2420 - op: Op::Wildcard(WildcardVersion::Major),
2431 - fn test_parsing_minor_wildcard_star() {
2432 - let r = range::parse("1.*").unwrap();
2434 - assert_eq!(Predicate {
2435 - op: Op::Wildcard(WildcardVersion::Minor),
2446 - fn test_parsing_minor_wildcard_x() {
2447 - let r = range::parse("1.x").unwrap();
2449 - assert_eq!(Predicate {
2450 - op: Op::Wildcard(WildcardVersion::Minor),
2461 - fn test_parsing_minor_wildcard_capital_x() {
2462 - let r = range::parse("1.X").unwrap();
2464 - assert_eq!(Predicate {
2465 - op: Op::Wildcard(WildcardVersion::Minor),
2476 - fn test_parsing_patch_wildcard_star() {
2477 - let r = range::parse("1.2.*").unwrap();
2479 - assert_eq!(Predicate {
2480 - op: Op::Wildcard(WildcardVersion::Patch),
2491 - fn test_parsing_patch_wildcard_x() {
2492 - let r = range::parse("1.2.x").unwrap();
2494 - assert_eq!(Predicate {
2495 - op: Op::Wildcard(WildcardVersion::Patch),
2506 - fn test_parsing_patch_wildcard_capital_x() {
2507 - let r = range::parse("1.2.X").unwrap();
2509 - assert_eq!(Predicate {
2510 - op: Op::Wildcard(WildcardVersion::Patch),
2521 - pub fn test_multiple_01() {
2522 - let r = range::parse("> 0.0.9, <= 2.5.3").unwrap();
2524 - assert_eq!(Predicate {
2534 - assert_eq!(Predicate {
2546 - pub fn test_multiple_02() {
2547 - let r = range::parse("0.3.0, 0.4.0").unwrap();
2549 - assert_eq!(Predicate {
2550 - op: Op::Compatible,
2559 - assert_eq!(Predicate {
2560 - op: Op::Compatible,
2571 - pub fn test_multiple_03() {
2572 - let r = range::parse("<= 0.2.0, >= 0.5.0").unwrap();
2574 - assert_eq!(Predicate {
2584 - assert_eq!(Predicate {
2596 - pub fn test_multiple_04() {
2597 - let r = range::parse("0.1.0, 0.1.4, 0.1.6").unwrap();
2599 - assert_eq!(Predicate {
2600 - op: Op::Compatible,
2609 - assert_eq!(Predicate {
2610 - op: Op::Compatible,
2619 - assert_eq!(Predicate {
2620 - op: Op::Compatible,
2631 - pub fn test_multiple_05() {
2632 - let r = range::parse(">=0.5.1-alpha3, <0.6").unwrap();
2634 - assert_eq!(Predicate {
2639 - pre: vec![Identifier::AlphaNumeric(String::from("alpha3"))],
2644 - assert_eq!(Predicate {
2656 - fn test_parse_build_metadata_with_predicate() {
2657 - assert_eq!(range::parse("^1.2.3+meta").unwrap().predicates[0].op,
2659 - assert_eq!(range::parse("~1.2.3+meta").unwrap().predicates[0].op,
2661 - assert_eq!(range::parse("=1.2.3+meta").unwrap().predicates[0].op,
2663 - assert_eq!(range::parse("<=1.2.3+meta").unwrap().predicates[0].op,
2665 - assert_eq!(range::parse(">=1.2.3+meta").unwrap().predicates[0].op,
2667 - assert_eq!(range::parse("<1.2.3+meta").unwrap().predicates[0].op,
2669 - assert_eq!(range::parse(">1.2.3+meta").unwrap().predicates[0].op,
2674 - pub fn test_parse_errors() {
2675 - assert!(range::parse("\0").is_err());
2676 - assert!(range::parse(">= >= 0.0.2").is_err());
2677 - assert!(range::parse(">== 0.0.2").is_err());
2678 - assert!(range::parse("a.0.0").is_err());
2679 - assert!(range::parse("1.0.0-").is_err());
2680 - assert!(range::parse(">=").is_err());
2681 - assert!(range::parse("> 0.1.0,").is_err());
2682 - assert!(range::parse("> 0.3.0, ,").is_err());
2686 - pub fn test_large_major_version() {
2687 - assert!(range::parse("18446744073709551617.0.0").is_err());
2691 - pub fn test_large_minor_version() {
2692 - assert!(range::parse("0.18446744073709551617.0").is_err());
2696 - pub fn test_large_patch_version() {
2697 - assert!(range::parse("0.0.18446744073709551617").is_err());
2700 diff --git a/third_party/rust/semver-parser/src/recognize.rs b/third_party/rust/semver-parser/src/recognize.rs
2701 deleted file mode 100644
2702 --- a/third_party/rust/semver-parser/src/recognize.rs
2705 -// Copyright 2017 Google Inc. All rights reserved.
2707 -// Licensed under either of MIT or Apache License, Version 2.0,
2710 -// Use of this source code is governed by a MIT-style
2711 -// license that can be found in the LICENSE file or at
2712 -// https://opensource.org/licenses/MIT.
2714 -// Licensed under the Apache License, Version 2.0 (the "License");
2715 -// you may not use this file except in compliance with the License.
2716 -// You may obtain a copy of the License at
2718 -// http://www.apache.org/licenses/LICENSE-2.0
2720 -// Unless required by applicable law or agreed to in writing, software
2721 -// distributed under the License is distributed on an "AS IS" BASIS,
2722 -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2723 -// See the License for the specific language governing permissions and
2724 -// limitations under the License.
2726 -//! Simple recognizer combinators.
2728 -// This version is similar to a similar one in the "lang" module of
2729 -// xi-editor, but is stripped down to only the needed combinators.
2733 -pub trait Recognize {
2734 - fn p(&self, s: &[u8]) -> Option<usize>;
2737 -impl<F: Fn(&[u8]) -> Option<usize>> Recognize for F {
2739 - fn p(&self, s: &[u8]) -> Option<usize> {
2744 -pub struct OneByte<F>(pub F);
2746 -impl<F: Fn(u8) -> bool> Recognize for OneByte<F> {
2748 - fn p(&self, s: &[u8]) -> Option<usize> {
2749 - if s.is_empty() || !self.0(s[0]) {
2757 -impl Recognize for u8 {
2759 - fn p(&self, s: &[u8]) -> Option<usize> {
2760 - OneByte(|b| b == *self).p(s)
2764 -/// Use Inclusive(a..b) to indicate an inclusive range. When a...b syntax becomes
2765 -/// stable, we can get rid of this and switch to that.
2766 -pub struct Inclusive<T>(pub T);
2768 -impl Recognize for Inclusive<ops::Range<u8>> {
2770 - fn p(&self, s: &[u8]) -> Option<usize> {
2771 - OneByte(|x| x >= self.0.start && x <= self.0.end).p(s)
2775 -impl<'a> Recognize for &'a [u8] {
2777 - fn p(&self, s: &[u8]) -> Option<usize> {
2778 - let len = self.len();
2779 - if s.len() >= len && &s[..len] == *self {
2787 -impl<'a> Recognize for &'a str {
2789 - fn p(&self, s: &[u8]) -> Option<usize> {
2790 - self.as_bytes().p(s)
2794 -impl<P1: Recognize, P2: Recognize> Recognize for (P1, P2) {
2796 - fn p(&self, s: &[u8]) -> Option<usize> {
2797 - self.0.p(s).and_then(|len1|
2798 - self.1.p(&s[len1..]).map(|len2|
2803 -/// Choice from two heterogeneous alternatives.
2804 -pub struct Alt<P1, P2>(pub P1, pub P2);
2806 -impl<P1: Recognize, P2: Recognize> Recognize for Alt<P1, P2> {
2808 - fn p(&self, s: &[u8]) -> Option<usize> {
2809 - self.0.p(s).or_else(|| self.1.p(s))
2813 -/// Choice from a homogenous slice of parsers.
2814 -pub struct OneOf<'a, P: 'a>(pub &'a [P]);
2816 -impl<'a, P: Recognize> Recognize for OneOf<'a, P> {
2818 - fn p(&self, s: &[u8]) -> Option<usize> {
2819 - for ref p in self.0 {
2820 - if let Some(len) = p.p(s) {
2828 -pub struct OneOrMore<P>(pub P);
2830 -impl<P: Recognize> Recognize for OneOrMore<P> {
2832 - fn p(&self, s: &[u8]) -> Option<usize> {
2834 - let mut count = 0;
2835 - while let Some(len) = self.0.p(&s[i..]) {
2847 -pub struct ZeroOrMore<P>(pub P);
2849 -impl<P: Recognize> Recognize for ZeroOrMore<P> {
2851 - fn p(&self, s: &[u8]) -> Option<usize> {
2853 - while let Some(len) = self.0.p(&s[i..]) {
2859 diff --git a/third_party/rust/semver-parser/src/version.rs b/third_party/rust/semver-parser/src/version.rs
2860 deleted file mode 100644
2861 --- a/third_party/rust/semver-parser/src/version.rs
2865 -use std::str::from_utf8;
2869 -use common::{self, numeric_identifier};
2871 -#[derive(Clone, Debug, PartialEq, Eq)]
2872 -pub struct Version {
2876 - pub pre: Vec<Identifier>,
2877 - pub build: Vec<Identifier>,
2880 -#[derive(Clone, Debug, PartialEq, Eq)]
2881 -pub enum Identifier {
2882 - /// An identifier that's solely numbers.
2884 - /// An identifier with letters and numbers.
2885 - AlphaNumeric(String),
2888 -pub fn parse(version: &str) -> Result<Version, String> {
2889 - let s = version.trim().as_bytes();
2891 - let major = if let Some((major, len)) = numeric_identifier(&s[i..]) {
2895 - return Err("Error parsing major identifier".to_string());
2897 - if let Some(len) = b'.'.p(&s[i..]) {
2900 - return Err("Expected dot".to_string());
2902 - let minor = if let Some((minor, len)) = numeric_identifier(&s[i..]) {
2906 - return Err("Error parsing minor identifier".to_string());
2908 - if let Some(len) = b'.'.p(&s[i..]) {
2911 - return Err("Expected dot".to_string());
2913 - let patch = if let Some((patch, len)) = numeric_identifier(&s[i..]) {
2917 - return Err("Error parsing patch identifier".to_string());
2919 - let (pre, pre_len) = common::parse_optional_meta(&s[i..], b'-')?;
2921 - let (build, build_len) = common::parse_optional_meta(&s[i..], b'+')?;
2924 - return Err("Extra junk after valid version: ".to_string() +
2925 - from_utf8(&s[i..]).unwrap());
2936 -impl fmt::Display for Version {
2937 - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2938 - try!(write!(f, "{}.{}.{}", self.major, self.minor, self.patch));
2939 - if !self.pre.is_empty() {
2940 - let strs: Vec<_> =
2941 - self.pre.iter().map(ToString::to_string).collect();
2942 - try!(write!(f, "-{}", strs.join(".")));
2944 - if !self.build.is_empty() {
2945 - let strs: Vec<_> =
2946 - self.build.iter().map(ToString::to_string).collect();
2947 - try!(write!(f, "+{}", strs.join(".")));
2953 -impl fmt::Display for Identifier {
2954 - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2956 - Identifier::Numeric(ref id) => id.fmt(f),
2957 - Identifier::AlphaNumeric(ref id) => id.fmt(f),
2968 - fn parse_empty() {
2971 - let parsed = version::parse(version);
2973 - assert!(parsed.is_err(), "empty string incorrectly considered a valid parse");
2977 - fn parse_blank() {
2978 - let version = " ";
2980 - let parsed = version::parse(version);
2982 - assert!(parsed.is_err(), "blank string incorrectly considered a valid parse");
2986 - fn parse_no_minor_patch() {
2987 - let version = "1";
2989 - let parsed = version::parse(version);
2991 - assert!(parsed.is_err(), format!("'{}' incorrectly considered a valid parse", version));
2995 - fn parse_no_patch() {
2996 - let version = "1.2";
2998 - let parsed = version::parse(version);
3000 - assert!(parsed.is_err(), format!("'{}' incorrectly considered a valid parse", version));
3004 - fn parse_empty_pre() {
3005 - let version = "1.2.3-";
3007 - let parsed = version::parse(version);
3009 - assert!(parsed.is_err(), format!("'{}' incorrectly considered a valid parse", version));
3013 - fn parse_letters() {
3014 - let version = "a.b.c";
3016 - let parsed = version::parse(version);
3018 - assert!(parsed.is_err(), format!("'{}' incorrectly considered a valid parse", version));
3022 - fn parse_with_letters() {
3023 - let version = "1.2.3 a.b.c";
3025 - let parsed = version::parse(version);
3027 - assert!(parsed.is_err(), format!("'{}' incorrectly considered a valid parse", version));
3031 - fn parse_basic_version() {
3032 - let version = "1.2.3";
3034 - let parsed = version::parse(version).unwrap();
3036 - assert_eq!(1, parsed.major);
3037 - assert_eq!(2, parsed.minor);
3038 - assert_eq!(3, parsed.patch);
3042 - fn parse_trims_input() {
3043 - let version = " 1.2.3 ";
3045 - let parsed = version::parse(version).unwrap();
3047 - assert_eq!(1, parsed.major);
3048 - assert_eq!(2, parsed.minor);
3049 - assert_eq!(3, parsed.patch);
3053 - fn parse_no_major_leading_zeroes() {
3054 - let version = "01.0.0";
3056 - let parsed = version::parse(version);
3058 - assert!(parsed.is_err(), "01 incorrectly considered a valid major version");
3062 - fn parse_no_minor_leading_zeroes() {
3063 - let version = "0.01.0";
3065 - let parsed = version::parse(version);
3067 - assert!(parsed.is_err(), "01 incorrectly considered a valid minor version");
3071 - fn parse_no_patch_leading_zeroes() {
3072 - let version = "0.0.01";
3074 - let parsed = version::parse(version);
3076 - assert!(parsed.is_err(), "01 incorrectly considered a valid patch version");
3080 - fn parse_no_major_overflow() {
3081 - let version = "98765432109876543210.0.0";
3083 - let parsed = version::parse(version);
3085 - assert!(parsed.is_err(), "98765432109876543210 incorrectly considered a valid major version");
3089 - fn parse_no_minor_overflow() {
3090 - let version = "0.98765432109876543210.0";
3092 - let parsed = version::parse(version);
3094 - assert!(parsed.is_err(), "98765432109876543210 incorrectly considered a valid minor version");
3098 - fn parse_no_patch_overflow() {
3099 - let version = "0.0.98765432109876543210";
3101 - let parsed = version::parse(version);
3103 - assert!(parsed.is_err(), "98765432109876543210 incorrectly considered a valid patch version");
3107 - fn parse_basic_prerelease() {
3108 - let version = "1.2.3-pre";
3110 - let parsed = version::parse(version).unwrap();
3112 - let expected_pre = vec![Identifier::AlphaNumeric(String::from("pre"))];
3113 - assert_eq!(expected_pre, parsed.pre);
3117 - fn parse_prerelease_alphanumeric() {
3118 - let version = "1.2.3-alpha1";
3120 - let parsed = version::parse(version).unwrap();
3122 - let expected_pre = vec![Identifier::AlphaNumeric(String::from("alpha1"))];
3123 - assert_eq!(expected_pre, parsed.pre);
3127 - fn parse_prerelease_zero() {
3128 - let version = "1.2.3-pre.0";
3130 - let parsed = version::parse(version).unwrap();
3132 - let expected_pre = vec![Identifier::AlphaNumeric(String::from("pre")),
3133 - Identifier::Numeric(0)];
3134 - assert_eq!(expected_pre, parsed.pre);
3138 - fn parse_basic_build() {
3139 - let version = "1.2.3+build";
3141 - let parsed = version::parse(version).unwrap();
3143 - let expected_build = vec![Identifier::AlphaNumeric(String::from("build"))];
3144 - assert_eq!(expected_build, parsed.build);
3148 - fn parse_build_alphanumeric() {
3149 - let version = "1.2.3+build5";
3151 - let parsed = version::parse(version).unwrap();
3153 - let expected_build = vec![Identifier::AlphaNumeric(String::from("build5"))];
3154 - assert_eq!(expected_build, parsed.build);
3158 - fn parse_pre_and_build() {
3159 - let version = "1.2.3-alpha1+build5";
3161 - let parsed = version::parse(version).unwrap();
3163 - let expected_pre = vec![Identifier::AlphaNumeric(String::from("alpha1"))];
3164 - assert_eq!(expected_pre, parsed.pre);
3166 - let expected_build = vec![Identifier::AlphaNumeric(String::from("build5"))];
3167 - assert_eq!(expected_build, parsed.build);
3171 - fn parse_complex_metadata_01() {
3172 - let version = "1.2.3-1.alpha1.9+build5.7.3aedf ";
3174 - let parsed = version::parse(version).unwrap();
3176 - let expected_pre = vec![Identifier::Numeric(1),
3177 - Identifier::AlphaNumeric(String::from("alpha1")),
3178 - Identifier::Numeric(9)];
3179 - assert_eq!(expected_pre, parsed.pre);
3181 - let expected_build = vec![Identifier::AlphaNumeric(String::from("build5")),
3182 - Identifier::Numeric(7),
3183 - Identifier::AlphaNumeric(String::from("3aedf"))];
3184 - assert_eq!(expected_build, parsed.build);
3188 - fn parse_complex_metadata_02() {
3189 - let version = "0.4.0-beta.1+0851523";
3191 - let parsed = version::parse(version).unwrap();
3193 - let expected_pre = vec![Identifier::AlphaNumeric(String::from("beta")),
3194 - Identifier::Numeric(1)];
3195 - assert_eq!(expected_pre, parsed.pre);
3197 - let expected_build = vec![Identifier::AlphaNumeric(String::from("0851523"))];
3198 - assert_eq!(expected_build, parsed.build);
3202 - fn parse_metadata_overflow() {
3203 - let version = "0.4.0-beta.1+98765432109876543210";
3205 - let parsed = version::parse(version).unwrap();
3207 - let expected_pre = vec![Identifier::AlphaNumeric(String::from("beta")),
3208 - Identifier::Numeric(1)];
3209 - assert_eq!(expected_pre, parsed.pre);
3211 - let expected_build = vec![Identifier::AlphaNumeric(String::from("98765432109876543210"))];
3212 - assert_eq!(expected_build, parsed.build);
3216 - fn parse_regression_01() {
3217 - let version = "0.0.0-WIP";
3219 - let parsed = version::parse(version).unwrap();
3221 - assert_eq!(0, parsed.major);
3222 - assert_eq!(0, parsed.minor);
3223 - assert_eq!(0, parsed.patch);
3225 - let expected_pre = vec![Identifier::AlphaNumeric(String::from("WIP"))];
3226 - assert_eq!(expected_pre, parsed.pre);
3229 diff --git a/third_party/rust/semver/.cargo-checksum.json b/third_party/rust/semver/.cargo-checksum.json
3230 --- a/third_party/rust/semver/.cargo-checksum.json
3231 +++ b/third_party/rust/semver/.cargo-checksum.json
3233 -{"files":{"Cargo.toml":"a5b995796b5559de8975a6fee7166c9fda6c21b449ec90bef5f9baaeddd479a5","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"c780d8c3c802c5fe2c316127900385010c3e57f71c851eea9e8ed8495e2030dd","src/lib.rs":"cb1725a8bb90c1043f187c6ba504d0a9d07793e2f39f5205f926c58849311770","src/version.rs":"ffdf9c628597b889f149f3b2b1245b97c774eae1ce7030bd19235eabecaaede0","src/version_req.rs":"40d20720f5fdc0b3d9e398e64eb448a65987229bd322cab0fedf0cf1843f3bd8","tests/deprecation.rs":"b5ec79e19d61968d05b96b876c449e54d43cbd1762c6e63c23c3470f9db56292","tests/regression.rs":"180b699ad029b81e6135d42f0a8e6d782177bc29a41132f875ee6f8607a46b56","tests/serde.rs":"cdbbefc576ffcc814c30dad9598ab87a7fd9d14c5f42f1349e1db6afc72f8fed"},"package":"1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"}
3234 \ No newline at end of file
3235 +{"files":{"Cargo.toml":"2a2126f8fe5d20540ae6cfbf6649ed3af365ffb9a0a788a7552a6e7649a7a75f","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"57659341319915482c0b83779fb7f3f0f3accb7a8b881965799116afb5e9f7e9","benches/parse.rs":"6531f66f80ce2fc83878f9bf84f94c42e96f1e709466f2b88be8d95a3cec1511","build.rs":"47b42941210d44567c8561107420d7825aa1d01332c2d2f8892d9e20646a1c77","src/backport.rs":"f8866548840434c8974f135528693f25aacc4ad03639c4e3aea3be351e13fdf8","src/display.rs":"9ba42f7a6579aa9c7dd72f2380036f5c9664592f3eacd09ea25cef291a3e64e5","src/error.rs":"3bb489f4a29f38d93370e64ae8d6e4e9b451a055cd7d392b6aeacab7eb3e1953","src/eval.rs":"b7e7ec976051b9f87ddf5cfdbaad64654d98d86ae0763f7d88b14eeaeac6013c","src/identifier.rs":"601231351ac58602b7d193cb0951b5146bd868b62aba938d5cbe52cf2b93414b","src/impls.rs":"79b5a2ac6ca3d4cb46adfb1494756079f53bef780dd81c3a8d3adf86f91395c8","src/lib.rs":"8e116a19e521909f3fa50206c078f1e23bf033dc8057ba6101f80d5bc5900fed","src/parse.rs":"93593f62cdae489feb4f2e8ae1fa93d90dca63db50669b6265346ffaaf687be5","src/serde.rs":"970d343a6bac21ddd965168d3cc2af9998796bf29bf545e8b37c6bcdd97d9710","tests/node/mod.rs":"2710d9b8daace2038b66db0f8f4cc522dee938e7cbc42d7739c31995343c32f4","tests/test_autotrait.rs":"070500c32ceee14a8a0110c04a01f98278b24614a0aec8c382dcea3da0343f58","tests/test_identifier.rs":"6c3da46c73df210527b60f1069131b15e2c65eb7b5d11793940d00cf66812f4d","tests/test_version.rs":"09e37c3df162205acf3683d1c760a6001e34e1c709fd4a1a265d82450e340003","tests/test_version_req.rs":"b6eea0258cc3b6d567a9f6c42693a97316345083495236c47e85374fd45f7cf0","tests/util/mod.rs":"db61c2cd86af864d8be4f2a3d5f25c86d7712201cc6ab47b715facf5f7f275b7"},"package":"8cb243bdfdb5936c8dc3c45762a19d12ab4550cdc753bc247637d4ec35a040fd"}
3236 \ No newline at end of file
3237 diff --git a/third_party/rust/semver/Cargo.toml b/third_party/rust/semver/Cargo.toml
3238 --- a/third_party/rust/semver/Cargo.toml
3239 +++ b/third_party/rust/semver/Cargo.toml
3241 # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
3243 # When uploading crates to the registry Cargo will automatically
3244 # "normalize" Cargo.toml files for maximal compatibility
3245 # with all versions of Cargo and also rewrite `path` dependencies
3246 -# to registry (e.g. crates.io) dependencies
3247 +# to registry (e.g., crates.io) dependencies.
3249 -# If you believe there's an error in this file please file an
3250 -# issue against the rust-lang/cargo repository. If you're
3251 -# editing this file be aware that the upstream Cargo.toml
3252 -# will likely look very different (and much more reasonable)
3253 +# If you are reading this file be aware that the original Cargo.toml
3254 +# will likely look very different (and much more reasonable).
3255 +# See Cargo.toml.orig for the original contents.
3259 +rust-version = "1.31"
3262 -authors = ["Steve Klabnik <steve@steveklabnik.com>", "The Rust Project Developers"]
3263 -description = "Semantic version parsing and comparison.\n"
3264 -homepage = "https://docs.rs/crate/semver/"
3265 -documentation = "https://docs.rs/crate/semver/"
3267 +authors = ["David Tolnay <dtolnay@gmail.com>"]
3268 +description = "Parser and evaluator for Cargo's flavor of Semantic Versioning"
3269 +documentation = "https://docs.rs/semver"
3270 readme = "README.md"
3271 -license = "MIT/Apache-2.0"
3272 -repository = "https://github.com/steveklabnik/semver"
3273 -[dependencies.semver-parser]
3275 +license = "MIT OR Apache-2.0"
3276 +repository = "https://github.com/dtolnay/semver"
3278 +[package.metadata.docs.rs]
3279 +targets = ["x86_64-unknown-linux-gnu"]
3285 [dependencies.serde]
3288 -[dev-dependencies.crates-index]
3291 -[dev-dependencies.serde_json]
3294 -[dev-dependencies.serde_derive]
3297 -[dev-dependencies.tempdir]
3299 +default-features = false
3305 -repository = "steveklabnik/semver"
3308 diff --git a/third_party/rust/semver/LICENSE-MIT b/third_party/rust/semver/LICENSE-MIT
3309 --- a/third_party/rust/semver/LICENSE-MIT
3310 +++ b/third_party/rust/semver/LICENSE-MIT
3312 -Copyright (c) 2014 The Rust Project Developers
3314 Permission is hereby granted, free of charge, to any
3315 person obtaining a copy of this software and associated
3316 documentation files (the "Software"), to deal in the
3317 Software without restriction, including without
3318 limitation the rights to use, copy, modify, merge,
3319 publish, distribute, sublicense, and/or sell copies of
3320 the Software, and to permit persons to whom the Software
3321 is furnished to do so, subject to the following
3322 diff --git a/third_party/rust/semver/README.md b/third_party/rust/semver/README.md
3323 --- a/third_party/rust/semver/README.md
3324 +++ b/third_party/rust/semver/README.md
3329 -Semantic version parsing and comparison.
3331 -[![Build Status](https://api.travis-ci.org/steveklabnik/semver.svg?branch=master)](https://travis-ci.org/steveklabnik/semver)
3333 -[Documentation](https://steveklabnik.github.io/semver)
3335 -Semantic versioning (see http://semver.org/) is a set of rules for
3336 -assigning version numbers.
3337 +[<img alt="github" src="https://img.shields.io/badge/github-dtolnay/semver-8da0cb?style=for-the-badge&labelColor=555555&logo=github" height="20">](https://github.com/dtolnay/semver)
3338 +[<img alt="crates.io" src="https://img.shields.io/crates/v/semver.svg?style=for-the-badge&color=fc8d62&logo=rust" height="20">](https://crates.io/crates/semver)
3339 +[<img alt="docs.rs" src="https://img.shields.io/badge/docs.rs-semver-66c2a5?style=for-the-badge&labelColor=555555&logoColor=white&logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoIGZpbGw9IiNmNWY1ZjUiIGQ9Ik00ODguNiAyNTAuMkwzOTIgMjE0VjEwNS41YzAtMTUtOS4zLTI4LjQtMjMuNC0zMy43bC0xMDAtMzcuNWMtOC4xLTMuMS0xNy4xLTMuMS0yNS4zIDBsLTEwMCAzNy41Yy0xNC4xIDUuMy0yMy40IDE4LjctMjMuNCAzMy43VjIxNGwtOTYuNiAzNi4yQzkuMyAyNTUuNSAwIDI2OC45IDAgMjgzLjlWMzk0YzAgMTMuNiA3LjcgMjYuMSAxOS45IDMyLjJsMTAwIDUwYzEwLjEgNS4xIDIyLjEgNS4xIDMyLjIgMGwxMDMuOS01MiAxMDMuOSA1MmMxMC4xIDUuMSAyMi4xIDUuMSAzMi4yIDBsMTAwLTUwYzEyLjItNi4xIDE5LjktMTguNiAxOS45LTMyLjJWMjgzLjljMC0xNS05LjMtMjguNC0yMy40LTMzLjd6TTM1OCAyMTQuOGwtODUgMzEuOXYtNjguMmw4NS0zN3Y3My4zek0xNTQgMTA0LjFsMTAyLTM4LjIgMTAyIDM4LjJ2LjZsLTEwMiA0MS40LTEwMi00MS40di0uNnptODQgMjkxLjFsLTg1IDQyLjV2LTc5LjFsODUtMzguOHY3NS40em0wLTExMmwtMTAyIDQxLjQtMTAyLTQxLjR2LS42bDEwMi0zOC4yIDEwMiAzOC4ydi42em0yNDAgMTEybC04NSA0Mi41di03OS4xbDg1LTM4Ljh2NzUuNHptMC0xMTJsLTEwMiA0MS40LTEwMi00MS40di0uNmwxMDItMzguMiAxMDIgMzguMnYuNnoiPjwvcGF0aD48L3N2Zz4K" height="20">](https://docs.rs/semver)
3340 +[<img alt="build status" src="https://img.shields.io/github/workflow/status/dtolnay/semver/CI/master?style=for-the-badge" height="20">](https://github.com/dtolnay/semver/actions?query=branch%3Amaster)
3342 -## SemVer and the Rust ecosystem
3344 -Rust itself follows the SemVer specification, as does its standard libraries. The two are
3346 +A parser and evaluator for Cargo's flavor of Semantic Versioning.
3348 -[Cargo](https://crates.io), Rust's package manager, uses SemVer to determine which versions of
3349 -packages you need installed.
3353 -To use `semver`, add this to your `[dependencies]` section:
3354 +Semantic Versioning (see <https://semver.org>) is a guideline for how version
3355 +numbers are assigned and incremented. It is widely followed within the
3356 +Cargo/crates.io ecosystem for Rust.
3362 -And this to your crate root:
3365 -extern crate semver;
3370 -At its simplest, the `semver` crate allows you to construct `Version` objects using the `parse`
3374 -use semver::Version;
3376 -assert!(Version::parse("1.2.3") == Ok(Version {
3387 -If you have multiple `Version`s, you can use the usual comparison operators to compare them:
3390 -use semver::Version;
3391 +*Compiler support: requires rustc 1.31+*
3393 -assert!(Version::parse("1.2.3-alpha") != Version::parse("1.2.3-beta"));
3394 -assert!(Version::parse("1.2.3-alpha2") > Version::parse("1.2.0"));
3400 -The `semver` crate also provides the ability to compare requirements, which are more complex
3403 -For example, creating a requirement that only matches versions greater than or
3408 -use semver::Version;
3409 -use semver::VersionReq;
3410 +use semver::{BuildMetadata, Prerelease, Version, VersionReq};
3413 + let req = VersionReq::parse(">=1.2.3, <1.8.0").unwrap();
3415 -let r = VersionReq::parse(">= 1.0.0").unwrap();
3416 -let v = Version::parse("1.0.0").unwrap();
3417 + // Check whether this requirement matches version 1.2.3-alpha.1 (no)
3418 + let version = Version {
3422 + pre: Prerelease::new("alpha.1").unwrap(),
3423 + build: BuildMetadata::EMPTY,
3425 + assert!(!req.matches(&version));
3427 -assert!(r.to_string() == ">= 1.0.0".to_string());
3428 -assert!(r.matches(&v))
3429 + // Check whether it matches 1.3.0 (yes it does)
3430 + let version = Version::parse("1.3.0").unwrap();
3431 + assert!(req.matches(&version));
3435 -It also allows parsing of `~x.y.z` and `^x.y.z` requirements as defined at
3436 -https://www.npmjs.org/doc/misc/semver.html
3439 +## Scope of this crate
3441 -**Tilde requirements** specify a minimal version with some updates:
3442 +Besides Cargo, several other package ecosystems and package managers for other
3443 +languages also use SemVer: RubyGems/Bundler for Ruby, npm for JavaScript,
3444 +Composer for PHP, CocoaPods for Objective-C...
3447 -~1.2.3 := >=1.2.3 <1.3.0
3448 -~1.2 := >=1.2.0 <1.3.0
3449 -~1 := >=1.0.0 <2.0.0
3451 +The `semver` crate is specifically intended to implement Cargo's interpretation
3452 +of Semantic Versioning.
3454 +Where the various tools differ in their interpretation or implementation of the
3455 +spec, this crate follows the implementation choices made by Cargo. If you are
3456 +operating on version numbers from some other package ecosystem, you will want to
3457 +use a different semver library which is appropriate to that ecosystem.
3459 +The extent of Cargo's SemVer support is documented in the *[Specifying
3460 +Dependencies]* chapter of the Cargo reference.
3462 -**Caret requirements** allow SemVer compatible updates to a specified version,
3463 -`0.x` and `0.x+1` are not considered compatible, but `1.x` and `1.x+1` are.
3464 +[Specifying Dependencies]: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html
3466 -`0.0.x` is not considered compatible with any other version.
3467 -Missing minor and patch versions are desugared to `0` but allow flexibility for that value.
3473 -^1.2.3 := >=1.2.3 <2.0.0
3474 -^0.2.3 := >=0.2.3 <0.3.0
3475 -^0.0.3 := >=0.0.3 <0.0.4
3476 -^0.0 := >=0.0.0 <0.1.0
3477 -^0 := >=0.0.0 <1.0.0
3480 +Licensed under either of <a href="LICENSE-APACHE">Apache License, Version
3481 +2.0</a> or <a href="LICENSE-MIT">MIT license</a> at your option.
3487 +Unless you explicitly state otherwise, any contribution intentionally submitted
3488 +for inclusion in this crate by you, as defined in the Apache-2.0 license, shall
3489 +be dual licensed as above, without any additional terms or conditions.
3491 diff --git a/third_party/rust/semver/benches/parse.rs b/third_party/rust/semver/benches/parse.rs
3492 new file mode 100644
3494 +++ b/third_party/rust/semver/benches/parse.rs
3500 +use semver::{Prerelease, Version, VersionReq};
3501 +use test::{black_box, Bencher};
3504 +fn parse_prerelease(b: &mut Bencher) {
3505 + let text = "x.7.z.92";
3506 + b.iter(|| black_box(text).parse::<Prerelease>().unwrap());
3510 +fn parse_version(b: &mut Bencher) {
3511 + let text = "1.0.2021-beta+exp.sha.5114f85";
3512 + b.iter(|| black_box(text).parse::<Version>().unwrap());
3516 +fn parse_version_req(b: &mut Bencher) {
3517 + let text = ">=1.2.3, <2.0.0";
3518 + b.iter(|| black_box(text).parse::<VersionReq>().unwrap());
3520 diff --git a/third_party/rust/semver/build.rs b/third_party/rust/semver/build.rs
3521 new file mode 100644
3523 +++ b/third_party/rust/semver/build.rs
3526 +use std::process::Command;
3530 + let compiler = match rustc_minor_version() {
3531 + Some(compiler) => compiler,
3535 + if compiler < 33 {
3536 + // Exhaustive integer patterns. On older compilers, a final `_` arm is
3537 + // required even if every possible integer value is otherwise covered.
3538 + // https://github.com/rust-lang/rust/issues/50907
3539 + println!("cargo:rustc-cfg=no_exhaustive_int_match");
3542 + if compiler < 36 {
3543 + // extern crate alloc.
3544 + // https://blog.rust-lang.org/2019/07/04/Rust-1.36.0.html#the-alloc-crate-is-stable
3545 + println!("cargo:rustc-cfg=no_alloc_crate");
3548 + if compiler < 39 {
3549 + // const Vec::new.
3550 + // https://doc.rust-lang.org/std/vec/struct.Vec.html#method.new
3551 + println!("cargo:rustc-cfg=no_const_vec_new");
3554 + if compiler < 40 {
3555 + // #[non_exhaustive].
3556 + // https://blog.rust-lang.org/2019/12/19/Rust-1.40.0.html#non_exhaustive-structs-enums-and-variants
3557 + println!("cargo:rustc-cfg=no_non_exhaustive");
3560 + if compiler < 45 {
3561 + // String::strip_prefix.
3562 + // https://doc.rust-lang.org/std/primitive.str.html#method.repeat
3563 + println!("cargo:rustc-cfg=no_str_strip_prefix");
3566 + if compiler < 46 {
3567 + // #[track_caller].
3568 + // https://blog.rust-lang.org/2020/08/27/Rust-1.46.0.html#track_caller
3569 + println!("cargo:rustc-cfg=no_track_caller");
3572 + if compiler < 52 {
3573 + // #![deny(unsafe_op_in_unsafe_fn)].
3574 + // https://github.com/rust-lang/rust/issues/71668
3575 + println!("cargo:rustc-cfg=no_unsafe_op_in_unsafe_fn_lint");
3578 + if compiler < 53 {
3579 + // Efficient intrinsics for count-leading-zeros and count-trailing-zeros
3580 + // on NonZero integers stabilized in 1.53.0. On many architectures these
3581 + // are more efficient than counting zeros on ordinary zeroable integers.
3582 + // https://doc.rust-lang.org/std/num/struct.NonZeroU64.html#method.leading_zeros
3583 + // https://doc.rust-lang.org/std/num/struct.NonZeroU64.html#method.trailing_zeros
3584 + println!("cargo:rustc-cfg=no_nonzero_bitscan");
3588 +fn rustc_minor_version() -> Option<u32> {
3589 + let rustc = env::var_os("RUSTC")?;
3590 + let output = Command::new(rustc).arg("--version").output().ok()?;
3591 + let version = str::from_utf8(&output.stdout).ok()?;
3592 + let mut pieces = version.split('.');
3593 + if pieces.next() != Some("rustc 1") {
3596 + pieces.next()?.parse().ok()
3598 diff --git a/third_party/rust/semver/src/backport.rs b/third_party/rust/semver/src/backport.rs
3599 new file mode 100644
3601 +++ b/third_party/rust/semver/src/backport.rs
3603 +#[cfg(no_str_strip_prefix)] // rustc <1.45
3604 +pub(crate) trait StripPrefixExt {
3605 + fn strip_prefix(&self, ch: char) -> Option<&str>;
3608 +#[cfg(no_str_strip_prefix)]
3609 +impl StripPrefixExt for str {
3610 + fn strip_prefix(&self, ch: char) -> Option<&str> {
3611 + if self.starts_with(ch) {
3612 + Some(&self[ch.len_utf8()..])
3619 +pub(crate) use crate::alloc::vec::Vec;
3621 +#[cfg(no_alloc_crate)] // rustc <1.36
3622 +pub(crate) mod alloc {
3628 + pub struct Layout {
3633 + pub unsafe fn from_size_align_unchecked(size: usize, align: usize) -> Self {
3634 + assert_eq!(align, 2);
3639 + pub unsafe fn alloc(layout: Layout) -> *mut u8 {
3640 + let len_u16 = (layout.size + 1) / 2;
3641 + let mut vec = Vec::new();
3642 + vec.reserve_exact(len_u16);
3643 + let ptr: *mut u16 = vec.as_mut_ptr();
3648 + pub unsafe fn dealloc(ptr: *mut u8, layout: Layout) {
3649 + let len_u16 = (layout.size + 1) / 2;
3650 + unsafe { Vec::from_raw_parts(ptr as *mut u16, 0, len_u16) };
3654 diff --git a/third_party/rust/semver/src/display.rs b/third_party/rust/semver/src/display.rs
3655 new file mode 100644
3657 +++ b/third_party/rust/semver/src/display.rs
3659 +use crate::{BuildMetadata, Comparator, Op, Prerelease, Version, VersionReq};
3660 +use core::fmt::{self, Alignment, Debug, Display, Write};
3662 +impl Display for Version {
3663 + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
3664 + let do_display = |formatter: &mut fmt::Formatter| -> fmt::Result {
3665 + write!(formatter, "{}.{}.{}", self.major, self.minor, self.patch)?;
3666 + if !self.pre.is_empty() {
3667 + write!(formatter, "-{}", self.pre)?;
3669 + if !self.build.is_empty() {
3670 + write!(formatter, "+{}", self.build)?;
3675 + let do_len = || -> usize {
3676 + digits(self.major)
3678 + + digits(self.minor)
3680 + + digits(self.patch)
3681 + + !self.pre.is_empty() as usize
3683 + + !self.build.is_empty() as usize
3684 + + self.build.len()
3687 + pad(formatter, do_display, do_len)
3691 +impl Display for VersionReq {
3692 + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
3693 + if self.comparators.is_empty() {
3694 + return formatter.write_str("*");
3696 + for (i, comparator) in self.comparators.iter().enumerate() {
3698 + formatter.write_str(", ")?;
3700 + write!(formatter, "{}", comparator)?;
3706 +impl Display for Comparator {
3707 + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
3708 + let op = match self.op {
3710 + Op::Greater => ">",
3711 + Op::GreaterEq => ">=",
3713 + Op::LessEq => "<=",
3716 + Op::Wildcard => "",
3717 + #[cfg(no_non_exhaustive)]
3718 + Op::__NonExhaustive => unreachable!(),
3720 + formatter.write_str(op)?;
3721 + write!(formatter, "{}", self.major)?;
3722 + if let Some(minor) = &self.minor {
3723 + write!(formatter, ".{}", minor)?;
3724 + if let Some(patch) = &self.patch {
3725 + write!(formatter, ".{}", patch)?;
3726 + if !self.pre.is_empty() {
3727 + write!(formatter, "-{}", self.pre)?;
3729 + } else if self.op == Op::Wildcard {
3730 + formatter.write_str(".*")?;
3732 + } else if self.op == Op::Wildcard {
3733 + formatter.write_str(".*")?;
3739 +impl Display for Prerelease {
3740 + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
3741 + formatter.write_str(self.as_str())
3745 +impl Display for BuildMetadata {
3746 + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
3747 + formatter.write_str(self.as_str())
3751 +impl Debug for Version {
3752 + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
3753 + let mut debug = formatter.debug_struct("Version");
3755 + .field("major", &self.major)
3756 + .field("minor", &self.minor)
3757 + .field("patch", &self.patch);
3758 + if !self.pre.is_empty() {
3759 + debug.field("pre", &self.pre);
3761 + if !self.build.is_empty() {
3762 + debug.field("build", &self.build);
3768 +impl Debug for Prerelease {
3769 + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
3770 + write!(formatter, "Prerelease(\"{}\")", self)
3774 +impl Debug for BuildMetadata {
3775 + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
3776 + write!(formatter, "BuildMetadata(\"{}\")", self)
3781 + formatter: &mut fmt::Formatter,
3782 + do_display: impl FnOnce(&mut fmt::Formatter) -> fmt::Result,
3783 + do_len: impl FnOnce() -> usize,
3785 + let min_width = match formatter.width() {
3786 + Some(min_width) => min_width,
3787 + None => return do_display(formatter),
3790 + let len = do_len();
3791 + if len >= min_width {
3792 + return do_display(formatter);
3795 + let default_align = Alignment::Left;
3796 + let align = formatter.align().unwrap_or(default_align);
3797 + let padding = min_width - len;
3798 + let (pre_pad, post_pad) = match align {
3799 + Alignment::Left => (0, padding),
3800 + Alignment::Right => (padding, 0),
3801 + Alignment::Center => (padding / 2, (padding + 1) / 2),
3804 + let fill = formatter.fill();
3805 + for _ in 0..pre_pad {
3806 + formatter.write_char(fill)?;
3809 + do_display(formatter)?;
3811 + for _ in 0..post_pad {
3812 + formatter.write_char(fill)?;
3817 +fn digits(val: u64) -> usize {
3821 + 1 + digits(val / 10)
3824 diff --git a/third_party/rust/semver/src/error.rs b/third_party/rust/semver/src/error.rs
3825 new file mode 100644
3827 +++ b/third_party/rust/semver/src/error.rs
3829 +use crate::parse::Error;
3830 +use core::fmt::{self, Debug, Display};
3832 +pub(crate) enum ErrorKind {
3833 + UnexpectedEnd(Position),
3834 + UnexpectedChar(Position, char),
3835 + UnexpectedCharAfter(Position, char),
3836 + ExpectedCommaFound(Position, char),
3837 + LeadingZero(Position),
3838 + Overflow(Position),
3839 + EmptySegment(Position),
3840 + IllegalCharacter(Position),
3841 + WildcardNotTheOnlyComparator(char),
3842 + UnexpectedAfterWildcard,
3843 + ExcessiveComparators,
3846 +#[derive(Copy, Clone, Eq, PartialEq)]
3847 +pub(crate) enum Position {
3855 +#[cfg(feature = "std")]
3856 +#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]
3857 +impl std::error::Error for Error {}
3859 +impl Display for Error {
3860 + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
3861 + match &self.kind {
3862 + ErrorKind::UnexpectedEnd(pos) => {
3863 + write!(formatter, "unexpected end of input while parsing {}", pos)
3865 + ErrorKind::UnexpectedChar(pos, ch) => {
3868 + "unexpected character {} while parsing {}",
3873 + ErrorKind::UnexpectedCharAfter(pos, ch) => {
3876 + "unexpected character {} after {}",
3881 + ErrorKind::ExpectedCommaFound(pos, ch) => {
3884 + "expected comma after {}, found {}",
3889 + ErrorKind::LeadingZero(pos) => {
3890 + write!(formatter, "invalid leading zero in {}", pos)
3892 + ErrorKind::Overflow(pos) => {
3893 + write!(formatter, "value of {} exceeds u64::MAX", pos)
3895 + ErrorKind::EmptySegment(pos) => {
3896 + write!(formatter, "empty identifier segment in {}", pos)
3898 + ErrorKind::IllegalCharacter(pos) => {
3899 + write!(formatter, "unexpected character in {}", pos)
3901 + ErrorKind::WildcardNotTheOnlyComparator(ch) => {
3904 + "wildcard req ({}) must be the only comparator in the version req",
3908 + ErrorKind::UnexpectedAfterWildcard => {
3909 + formatter.write_str("unexpected character after wildcard in version req")
3911 + ErrorKind::ExcessiveComparators => {
3912 + formatter.write_str("excessive number of version comparators")
3918 +impl Display for Position {
3919 + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
3920 + formatter.write_str(match self {
3921 + Position::Major => "major version number",
3922 + Position::Minor => "minor version number",
3923 + Position::Patch => "patch version number",
3924 + Position::Pre => "pre-release identifier",
3925 + Position::Build => "build metadata",
3930 +impl Debug for Error {
3931 + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
3932 + formatter.write_str("Error(\"")?;
3933 + Display::fmt(self, formatter)?;
3934 + formatter.write_str("\")")?;
3939 +struct QuotedChar(char);
3941 +impl Display for QuotedChar {
3942 + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
3943 + // Standard library versions prior to https://github.com/rust-lang/rust/pull/95345
3944 + // print character 0 as '\u{0}'. We prefer '\0' to keep error messages
3945 + // the same across all supported Rust versions.
3946 + if self.0 == '\0' {
3947 + formatter.write_str("'\\0'")
3949 + write!(formatter, "{:?}", self.0)
3953 diff --git a/third_party/rust/semver/src/eval.rs b/third_party/rust/semver/src/eval.rs
3954 new file mode 100644
3956 +++ b/third_party/rust/semver/src/eval.rs
3958 +use crate::{Comparator, Op, Version, VersionReq};
3960 +pub(crate) fn matches_req(req: &VersionReq, ver: &Version) -> bool {
3961 + for cmp in &req.comparators {
3962 + if !matches_impl(cmp, ver) {
3967 + if ver.pre.is_empty() {
3971 + // If a version has a prerelease tag (for example, 1.2.3-alpha.3) then it
3972 + // will only be allowed to satisfy req if at least one comparator with the
3973 + // same major.minor.patch also has a prerelease tag.
3974 + for cmp in &req.comparators {
3975 + if pre_is_compatible(cmp, ver) {
3983 +pub(crate) fn matches_comparator(cmp: &Comparator, ver: &Version) -> bool {
3984 + matches_impl(cmp, ver) && (ver.pre.is_empty() || pre_is_compatible(cmp, ver))
3987 +fn matches_impl(cmp: &Comparator, ver: &Version) -> bool {
3989 + Op::Exact | Op::Wildcard => matches_exact(cmp, ver),
3990 + Op::Greater => matches_greater(cmp, ver),
3991 + Op::GreaterEq => matches_exact(cmp, ver) || matches_greater(cmp, ver),
3992 + Op::Less => matches_less(cmp, ver),
3993 + Op::LessEq => matches_exact(cmp, ver) || matches_less(cmp, ver),
3994 + Op::Tilde => matches_tilde(cmp, ver),
3995 + Op::Caret => matches_caret(cmp, ver),
3996 + #[cfg(no_non_exhaustive)]
3997 + Op::__NonExhaustive => unreachable!(),
4001 +fn matches_exact(cmp: &Comparator, ver: &Version) -> bool {
4002 + if ver.major != cmp.major {
4006 + if let Some(minor) = cmp.minor {
4007 + if ver.minor != minor {
4012 + if let Some(patch) = cmp.patch {
4013 + if ver.patch != patch {
4018 + ver.pre == cmp.pre
4021 +fn matches_greater(cmp: &Comparator, ver: &Version) -> bool {
4022 + if ver.major != cmp.major {
4023 + return ver.major > cmp.major;
4027 + None => return false,
4029 + if ver.minor != minor {
4030 + return ver.minor > minor;
4036 + None => return false,
4038 + if ver.patch != patch {
4039 + return ver.patch > patch;
4047 +fn matches_less(cmp: &Comparator, ver: &Version) -> bool {
4048 + if ver.major != cmp.major {
4049 + return ver.major < cmp.major;
4053 + None => return false,
4055 + if ver.minor != minor {
4056 + return ver.minor < minor;
4062 + None => return false,
4064 + if ver.patch != patch {
4065 + return ver.patch < patch;
4073 +fn matches_tilde(cmp: &Comparator, ver: &Version) -> bool {
4074 + if ver.major != cmp.major {
4078 + if let Some(minor) = cmp.minor {
4079 + if ver.minor != minor {
4084 + if let Some(patch) = cmp.patch {
4085 + if ver.patch != patch {
4086 + return ver.patch > patch;
4090 + ver.pre >= cmp.pre
4093 +fn matches_caret(cmp: &Comparator, ver: &Version) -> bool {
4094 + if ver.major != cmp.major {
4098 + let minor = match cmp.minor {
4099 + None => return true,
4100 + Some(minor) => minor,
4103 + let patch = match cmp.patch {
4105 + if cmp.major > 0 {
4106 + return ver.minor >= minor;
4108 + return ver.minor == minor;
4111 + Some(patch) => patch,
4114 + if cmp.major > 0 {
4115 + if ver.minor != minor {
4116 + return ver.minor > minor;
4117 + } else if ver.patch != patch {
4118 + return ver.patch > patch;
4120 + } else if minor > 0 {
4121 + if ver.minor != minor {
4123 + } else if ver.patch != patch {
4124 + return ver.patch > patch;
4126 + } else if ver.minor != minor || ver.patch != patch {
4130 + ver.pre >= cmp.pre
4133 +fn pre_is_compatible(cmp: &Comparator, ver: &Version) -> bool {
4134 + cmp.major == ver.major
4135 + && cmp.minor == Some(ver.minor)
4136 + && cmp.patch == Some(ver.patch)
4137 + && !cmp.pre.is_empty()
4139 diff --git a/third_party/rust/semver/src/identifier.rs b/third_party/rust/semver/src/identifier.rs
4140 new file mode 100644
4142 +++ b/third_party/rust/semver/src/identifier.rs
4144 +// This module implements Identifier, a short-optimized string allowed to
4145 +// contain only the ASCII characters hyphen, dot, 0-9, A-Z, a-z.
4147 +// As of mid-2021, the distribution of pre-release lengths on crates.io is:
4149 +// length count length count length count
4150 +// 0 355929 11 81 24 2
4151 +// 1 208 12 48 25 6
4152 +// 2 236 13 55 26 10
4153 +// 3 1909 14 25 27 4
4154 +// 4 1284 15 15 28 1
4155 +// 5 1742 16 35 30 1
4156 +// 6 3440 17 9 31 5
4157 +// 7 5624 18 6 32 1
4158 +// 8 1321 19 12 36 2
4159 +// 9 179 20 2 37 379
4162 +// and the distribution of build metadata lengths is:
4164 +// length count length count length count
4165 +// 0 364445 8 7725 18 1
4174 +// Therefore it really behooves us to be able to use the entire 8 bytes of a
4175 +// pointer for inline storage. For both pre-release and build metadata there are
4176 +// vastly more strings with length exactly 8 bytes than the sum over all lengths
4177 +// longer than 8 bytes.
4179 +// To differentiate the inline representation from the heap allocated long
4180 +// representation, we'll allocate heap pointers with 2-byte alignment so that
4181 +// they are guaranteed to have an unset least significant bit. Then in the repr
4182 +// we store for pointers, we rotate a 1 into the most significant bit of the
4183 +// most significant byte, which is never set for an ASCII byte.
4187 +// 0xxxxxxx 0xxxxxxx 0xxxxxxx 0xxxxxxx 0xxxxxxx 0xxxxxxx 0xxxxxxx 0xxxxxxx
4189 +// Heap allocated repr:
4191 +// 1ppppppp pppppppp pppppppp pppppppp pppppppp pppppppp pppppppp pppppppp 0
4192 +// ^ most significant bit least significant bit of orig ptr, rotated out ^
4194 +// Since the most significant bit doubles as a sign bit for the similarly sized
4195 +// signed integer type, the CPU has an efficient instruction for inspecting it,
4196 +// meaning we can differentiate between an inline repr and a heap allocated repr
4197 +// in one instruction. Effectively an inline repr always looks like a positive
4198 +// i64 while a heap allocated repr always looks like a negative i64.
4200 +// For the inline repr, we store \0 padding on the end of the stored characters,
4201 +// and thus the string length is readily determined efficiently by a cttz (count
4202 +// trailing zeros) or bsf (bit scan forward) instruction.
4204 +// For the heap allocated repr, the length is encoded as a base-128 varint at
4205 +// the head of the allocation.
4207 +// Empty strings are stored as an all-1 bit pattern, corresponding to -1i64.
4208 +// Consequently the all-0 bit pattern is never a legal representation in any
4209 +// repr, leaving it available as a niche for downstream code. For example this
4210 +// allows size_of::<Version>() == size_of::<Option<Version>>().
4212 +use crate::alloc::alloc::{alloc, dealloc, Layout};
4214 +use core::num::{NonZeroU64, NonZeroUsize};
4215 +use core::ptr::{self, NonNull};
4219 +const PTR_BYTES: usize = mem::size_of::<NonNull<u8>>();
4221 +// If pointers are already 8 bytes or bigger, then 0. If pointers are smaller
4222 +// than 8 bytes, then Identifier will contain a byte array to raise its size up
4223 +// to 8 bytes total.
4224 +const TAIL_BYTES: usize = 8 * (PTR_BYTES < 8) as usize - PTR_BYTES * (PTR_BYTES < 8) as usize;
4226 +#[repr(C, align(8))]
4227 +pub(crate) struct Identifier {
4228 + head: NonNull<u8>,
4229 + tail: [u8; TAIL_BYTES],
4233 + pub(crate) const fn empty() -> Self {
4234 + // This is a separate constant because unsafe function calls are not
4235 + // allowed in a const fn body, only in a const, until later rustc than
4236 + // what we support.
4237 + const HEAD: NonNull<u8> = unsafe { NonNull::new_unchecked(!0 as *mut u8) };
4242 + tail: [!0; TAIL_BYTES],
4246 + // SAFETY: string must be ASCII and not contain \0 bytes.
4247 + pub(crate) unsafe fn new_unchecked(string: &str) -> Self {
4248 + let len = string.len();
4249 + match len as u64 {
4250 + 0 => Self::empty(),
4252 + let mut bytes = [0u8; mem::size_of::<Identifier>()];
4253 + // SAFETY: string is big enough to read len bytes, bytes is big
4254 + // enough to write len bytes, and they do not overlap.
4255 + unsafe { ptr::copy_nonoverlapping(string.as_ptr(), bytes.as_mut_ptr(), len) };
4256 + // SAFETY: the head field is nonzero because the input string
4257 + // was at least 1 byte of ASCII and did not contain \0.
4258 + unsafe { mem::transmute::<[u8; mem::size_of::<Identifier>()], Identifier>(bytes) }
4260 + 9..=0xff_ffff_ffff_ffff => {
4261 + // SAFETY: len is in a range that does not contain 0.
4262 + let size = bytes_for_varint(unsafe { NonZeroUsize::new_unchecked(len) }) + len;
4264 + // SAFETY: align is not zero, align is a power of two, and
4265 + // rounding size up to align does not overflow usize::MAX.
4266 + let layout = unsafe { Layout::from_size_align_unchecked(size, align) };
4267 + // SAFETY: layout's size is nonzero.
4268 + let ptr = unsafe { alloc(layout) };
4269 + let mut write = ptr;
4270 + let mut varint_remaining = len;
4271 + while varint_remaining > 0 {
4272 + // SAFETY: size is bytes_for_varint(len) bytes + len bytes.
4273 + // This is writing the first bytes_for_varint(len) bytes.
4274 + unsafe { ptr::write(write, varint_remaining as u8 | 0x80) };
4275 + varint_remaining >>= 7;
4276 + // SAFETY: still in bounds of the same allocation.
4277 + write = unsafe { write.add(1) };
4279 + // SAFETY: size is bytes_for_varint(len) bytes + len bytes. This
4280 + // is writing to the last len bytes.
4281 + unsafe { ptr::copy_nonoverlapping(string.as_ptr(), write, len) };
4283 + head: ptr_to_repr(ptr),
4284 + tail: [0; TAIL_BYTES],
4287 + 0x100_0000_0000_0000..=0xffff_ffff_ffff_ffff => {
4288 + unreachable!("please refrain from storing >64 petabytes of text in semver version");
4290 + #[cfg(no_exhaustive_int_match)] // rustc <1.33
4291 + _ => unreachable!(),
4295 + pub(crate) fn is_empty(&self) -> bool {
4296 + // `cmp rdi, -1` -- basically: `repr as i64 == -1`
4297 + let empty = Self::empty();
4298 + let is_empty = self.head == empty.head && self.tail == empty.tail;
4299 + // The empty representation does nothing on Drop. We can't let this one
4300 + // drop normally because `impl Drop for Identifier` calls is_empty; that
4301 + // would be an infinite recursion.
4302 + mem::forget(empty);
4306 + fn is_inline(&self) -> bool {
4307 + // `test rdi, rdi` -- basically: `repr as i64 >= 0`
4308 + self.head.as_ptr() as usize >> (PTR_BYTES * 8 - 1) == 0
4311 + fn is_empty_or_inline(&self) -> bool {
4312 + // `cmp rdi, -2` -- basically: `repr as i64 > -2`
4313 + self.is_empty() || self.is_inline()
4316 + pub(crate) fn as_str(&self) -> &str {
4317 + if self.is_empty() {
4319 + } else if self.is_inline() {
4320 + // SAFETY: repr is in the inline representation.
4321 + unsafe { inline_as_str(self) }
4323 + // SAFETY: repr is in the heap allocated representation.
4324 + unsafe { ptr_as_str(&self.head) }
4329 +impl Clone for Identifier {
4330 + fn clone(&self) -> Self {
4331 + if self.is_empty_or_inline() {
4337 + let ptr = repr_to_ptr(self.head);
4338 + // SAFETY: ptr is one of our own heap allocations.
4339 + let len = unsafe { decode_len(ptr) };
4340 + let size = bytes_for_varint(len) + len.get();
4342 + // SAFETY: align is not zero, align is a power of two, and rounding
4343 + // size up to align does not overflow usize::MAX. This is just
4344 + // duplicating a previous allocation where all of these guarantees
4345 + // were already made.
4346 + let layout = unsafe { Layout::from_size_align_unchecked(size, align) };
4347 + // SAFETY: layout's size is nonzero.
4348 + let clone = unsafe { alloc(layout) };
4349 + // SAFETY: new allocation cannot overlap the previous one (this was
4350 + // not a realloc). The argument ptrs are readable/writeable
4351 + // respectively for size bytes.
4352 + unsafe { ptr::copy_nonoverlapping(ptr, clone, size) }
4354 + head: ptr_to_repr(clone),
4355 + tail: [0; TAIL_BYTES],
4361 +impl Drop for Identifier {
4362 + fn drop(&mut self) {
4363 + if self.is_empty_or_inline() {
4366 + let ptr = repr_to_ptr_mut(self.head);
4367 + // SAFETY: ptr is one of our own heap allocations.
4368 + let len = unsafe { decode_len(ptr) };
4369 + let size = bytes_for_varint(len) + len.get();
4371 + // SAFETY: align is not zero, align is a power of two, and rounding
4372 + // size up to align does not overflow usize::MAX. These guarantees were
4373 + // made when originally allocating this memory.
4374 + let layout = unsafe { Layout::from_size_align_unchecked(size, align) };
4375 + // SAFETY: ptr was previously allocated by the same allocator with the
4377 + unsafe { dealloc(ptr, layout) }
4381 +impl PartialEq for Identifier {
4382 + fn eq(&self, rhs: &Self) -> bool {
4383 + if self.is_empty_or_inline() {
4384 + // Fast path (most common)
4385 + self.head == rhs.head && self.tail == rhs.tail
4386 + } else if rhs.is_empty_or_inline() {
4389 + // SAFETY: both reprs are in the heap allocated representation.
4390 + unsafe { ptr_as_str(&self.head) == ptr_as_str(&rhs.head) }
4395 +unsafe impl Send for Identifier {}
4396 +unsafe impl Sync for Identifier {}
4398 +// We use heap pointers that are 2-byte aligned, meaning they have an
4399 +// insignificant 0 in the least significant bit. We take advantage of that
4400 +// unneeded bit to rotate a 1 into the most significant bit to make the repr
4401 +// distinguishable from ASCII bytes.
4402 +fn ptr_to_repr(original: *mut u8) -> NonNull<u8> {
4404 + // `shld rax, rdi, 63`
4405 + let modified = (original as usize | 1).rotate_right(1);
4407 + // `original + (modified - original)`, but being mindful of provenance.
4408 + let diff = modified.wrapping_sub(original as usize);
4409 + let modified = original.wrapping_add(diff);
4411 + // SAFETY: the most significant bit of repr is known to be set, so the value
4413 + unsafe { NonNull::new_unchecked(modified) }
4416 +// Shift out the 1 previously placed into the most significant bit of the least
4417 +// significant byte. Shift in a low 0 bit to reconstruct the original 2-byte
4418 +// aligned pointer.
4419 +fn repr_to_ptr(modified: NonNull<u8>) -> *const u8 {
4420 + // `lea rax, [rdi + rdi]`
4421 + let modified = modified.as_ptr();
4422 + let original = (modified as usize) << 1;
4424 + // `modified + (original - modified)`, but being mindful of provenance.
4425 + let diff = original.wrapping_sub(modified as usize);
4426 + modified.wrapping_add(diff)
4429 +fn repr_to_ptr_mut(repr: NonNull<u8>) -> *mut u8 {
4430 + repr_to_ptr(repr) as *mut u8
4433 +// Compute the length of the inline string, assuming the argument is in short
4434 +// string representation. Short strings are stored as 1 to 8 nonzero ASCII
4435 +// bytes, followed by \0 padding for the remaining bytes.
4437 +// SAFETY: the identifier must indeed be in the inline representation.
4438 +unsafe fn inline_len(repr: &Identifier) -> NonZeroUsize {
4439 + // SAFETY: Identifier's layout is align(8) and at least size 8. We're doing
4440 + // an aligned read of the first 8 bytes from it. The bytes are not all zero
4441 + // because inline strings are at least 1 byte long and cannot contain \0.
4442 + let repr = unsafe { ptr::read(repr as *const Identifier as *const NonZeroU64) };
4444 + // Rustc >=1.53 has intrinsics for counting zeros on a non-zeroable integer.
4445 + // On many architectures these are more efficient than counting on ordinary
4446 + // zeroable integers (bsf vs cttz). On rustc <1.53 without those intrinsics,
4447 + // we count zeros in the u64 rather than the NonZeroU64.
4448 + #[cfg(no_nonzero_bitscan)]
4449 + let repr = repr.get();
4451 + #[cfg(target_endian = "little")]
4452 + let zero_bits_on_string_end = repr.leading_zeros();
4453 + #[cfg(target_endian = "big")]
4454 + let zero_bits_on_string_end = repr.trailing_zeros();
4456 + let nonzero_bytes = 8 - zero_bits_on_string_end as usize / 8;
4458 + // SAFETY: repr is nonzero, so it has at most 63 zero bits on either end,
4459 + // thus at least one nonzero byte.
4460 + unsafe { NonZeroUsize::new_unchecked(nonzero_bytes) }
4463 +// SAFETY: repr must be in the inline representation, i.e. at least 1 and at
4464 +// most 8 nonzero ASCII bytes padded on the end with \0 bytes.
4465 +unsafe fn inline_as_str(repr: &Identifier) -> &str {
4466 + let ptr = repr as *const Identifier as *const u8;
4467 + let len = unsafe { inline_len(repr) }.get();
4468 + // SAFETY: we are viewing the nonzero ASCII prefix of the inline repr's
4469 + // contents as a slice of bytes. Input/output lifetimes are correctly
4471 + let slice = unsafe { slice::from_raw_parts(ptr, len) };
4472 + // SAFETY: the string contents are known to be only ASCII bytes, which are
4473 + // always valid UTF-8.
4474 + unsafe { str::from_utf8_unchecked(slice) }
4477 +// Decode varint. Varints consist of between one and eight base-128 digits, each
4478 +// of which is stored in a byte with most significant bit set. Adjacent to the
4479 +// varint in memory there is guaranteed to be at least 9 ASCII bytes, each of
4480 +// which has an unset most significant bit.
4482 +// SAFETY: ptr must be one of our own heap allocations, with the varint header
4483 +// already written.
4484 +unsafe fn decode_len(ptr: *const u8) -> NonZeroUsize {
4485 + // SAFETY: There is at least one byte of varint followed by at least 9 bytes
4486 + // of string content, which is at least 10 bytes total for the allocation,
4487 + // so reading the first two is no problem.
4488 + let [first, second] = unsafe { ptr::read(ptr as *const [u8; 2]) };
4489 + if second < 0x80 {
4490 + // SAFETY: the length of this heap allocated string has been encoded as
4491 + // one base-128 digit, so the length is at least 9 and at most 127. It
4492 + // cannot be zero.
4493 + unsafe { NonZeroUsize::new_unchecked((first & 0x7f) as usize) }
4495 + return unsafe { decode_len_cold(ptr) };
4497 + // Identifiers 128 bytes or longer. This is not exercised by any crate
4498 + // version currently published to crates.io.
4501 + unsafe fn decode_len_cold(mut ptr: *const u8) -> NonZeroUsize {
4503 + let mut shift = 0;
4505 + // SAFETY: varint continues while there are bytes having the
4506 + // most significant bit set, i.e. until we start hitting the
4507 + // ASCII string content with msb unset.
4508 + let byte = unsafe { *ptr };
4510 + // SAFETY: the string length is known to be 128 bytes or
4512 + return unsafe { NonZeroUsize::new_unchecked(len) };
4514 + // SAFETY: still in bounds of the same allocation.
4515 + ptr = unsafe { ptr.add(1) };
4516 + len += ((byte & 0x7f) as usize) << shift;
4523 +// SAFETY: repr must be in the heap allocated representation, with varint header
4524 +// and string contents already written.
4525 +unsafe fn ptr_as_str(repr: &NonNull<u8>) -> &str {
4526 + let ptr = repr_to_ptr(*repr);
4527 + let len = unsafe { decode_len(ptr) };
4528 + let header = bytes_for_varint(len);
4529 + let slice = unsafe { slice::from_raw_parts(ptr.add(header), len.get()) };
4530 + // SAFETY: all identifier contents are ASCII bytes, which are always valid
4532 + unsafe { str::from_utf8_unchecked(slice) }
4535 +// Number of base-128 digits required for the varint representation of a length.
4536 +fn bytes_for_varint(len: NonZeroUsize) -> usize {
4537 + #[cfg(no_nonzero_bitscan)] // rustc <1.53
4538 + let len = len.get();
4540 + let usize_bits = mem::size_of::<usize>() * 8;
4541 + let len_bits = usize_bits - len.leading_zeros() as usize;
4542 + (len_bits + 6) / 7
4544 diff --git a/third_party/rust/semver/src/impls.rs b/third_party/rust/semver/src/impls.rs
4545 new file mode 100644
4547 +++ b/third_party/rust/semver/src/impls.rs
4549 +use crate::backport::*;
4550 +use crate::identifier::Identifier;
4551 +use crate::{BuildMetadata, Comparator, Prerelease, VersionReq};
4552 +use core::cmp::Ordering;
4553 +use core::hash::{Hash, Hasher};
4554 +use core::iter::FromIterator;
4555 +use core::ops::Deref;
4557 +impl Default for Identifier {
4558 + fn default() -> Self {
4559 + Identifier::empty()
4563 +impl Eq for Identifier {}
4565 +impl Hash for Identifier {
4566 + fn hash<H: Hasher>(&self, hasher: &mut H) {
4567 + self.as_str().hash(hasher);
4571 +impl Deref for Prerelease {
4572 + type Target = str;
4574 + fn deref(&self) -> &Self::Target {
4575 + self.identifier.as_str()
4579 +impl Deref for BuildMetadata {
4580 + type Target = str;
4582 + fn deref(&self) -> &Self::Target {
4583 + self.identifier.as_str()
4587 +impl PartialOrd for Prerelease {
4588 + fn partial_cmp(&self, rhs: &Self) -> Option<Ordering> {
4589 + Some(Ord::cmp(self, rhs))
4593 +impl PartialOrd for BuildMetadata {
4594 + fn partial_cmp(&self, rhs: &Self) -> Option<Ordering> {
4595 + Some(Ord::cmp(self, rhs))
4599 +impl Ord for Prerelease {
4600 + fn cmp(&self, rhs: &Self) -> Ordering {
4601 + match self.is_empty() {
4602 + true if rhs.is_empty() => return Ordering::Equal,
4603 + // A real release compares greater than prerelease.
4604 + true => return Ordering::Greater,
4605 + // Prerelease compares less than the real release.
4606 + false if rhs.is_empty() => return Ordering::Less,
4610 + let lhs = self.as_str().split('.');
4611 + let mut rhs = rhs.as_str().split('.');
4614 + let rhs = match rhs.next() {
4615 + // Spec: "A larger set of pre-release fields has a higher
4616 + // precedence than a smaller set, if all of the preceding
4617 + // identifiers are equal."
4618 + None => return Ordering::Greater,
4622 + let string_cmp = || Ord::cmp(lhs, rhs);
4623 + let is_ascii_digit = |b: u8| b.is_ascii_digit();
4624 + let ordering = match (
4625 + lhs.bytes().all(is_ascii_digit),
4626 + rhs.bytes().all(is_ascii_digit),
4628 + // Respect numeric ordering, for example 99 < 100. Spec says:
4629 + // "Identifiers consisting of only digits are compared
4631 + (true, true) => Ord::cmp(&lhs.len(), &rhs.len()).then_with(string_cmp),
4632 + // Spec: "Numeric identifiers always have lower precedence than
4633 + // non-numeric identifiers."
4634 + (true, false) => return Ordering::Less,
4635 + (false, true) => return Ordering::Greater,
4636 + // Spec: "Identifiers with letters or hyphens are compared
4637 + // lexically in ASCII sort order."
4638 + (false, false) => string_cmp(),
4641 + if ordering != Ordering::Equal {
4646 + if rhs.next().is_none() {
4654 +impl Ord for BuildMetadata {
4655 + fn cmp(&self, rhs: &Self) -> Ordering {
4656 + let lhs = self.as_str().split('.');
4657 + let mut rhs = rhs.as_str().split('.');
4660 + let rhs = match rhs.next() {
4661 + None => return Ordering::Greater,
4665 + let is_ascii_digit = |b: u8| b.is_ascii_digit();
4666 + let ordering = match (
4667 + lhs.bytes().all(is_ascii_digit),
4668 + rhs.bytes().all(is_ascii_digit),
4671 + // 0 < 00 < 1 < 01 < 001 < 2 < 02 < 002 < 10
4672 + let lhval = lhs.trim_start_matches('0');
4673 + let rhval = rhs.trim_start_matches('0');
4674 + Ord::cmp(&lhval.len(), &rhval.len())
4675 + .then_with(|| Ord::cmp(lhval, rhval))
4676 + .then_with(|| Ord::cmp(&lhs.len(), &rhs.len()))
4678 + (true, false) => return Ordering::Less,
4679 + (false, true) => return Ordering::Greater,
4680 + (false, false) => Ord::cmp(lhs, rhs),
4683 + if ordering != Ordering::Equal {
4688 + if rhs.next().is_none() {
4696 +impl FromIterator<Comparator> for VersionReq {
4697 + fn from_iter<I>(iter: I) -> Self
4699 + I: IntoIterator<Item = Comparator>,
4701 + let comparators = Vec::from_iter(iter);
4702 + VersionReq { comparators }
4705 diff --git a/third_party/rust/semver/src/lib.rs b/third_party/rust/semver/src/lib.rs
4706 --- a/third_party/rust/semver/src/lib.rs
4707 +++ b/third_party/rust/semver/src/lib.rs
4709 -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
4710 -// file at the top-level directory of this distribution and at
4711 -// http://rust-lang.org/COPYRIGHT.
4713 -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4714 -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
4715 -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
4716 -// option. This file may not be copied, modified, or distributed
4717 -// except according to those terms.
4719 -//! Semantic version parsing and comparison.
4720 +//! [![github]](https://github.com/dtolnay/semver) [![crates-io]](https://crates.io/crates/semver) [![docs-rs]](https://docs.rs/semver)
4722 -//! Semantic versioning (see http://semver.org/) is a set of rules for
4723 -//! assigning version numbers.
4724 +//! [github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=github
4725 +//! [crates-io]: https://img.shields.io/badge/crates.io-fc8d62?style=for-the-badge&labelColor=555555&logo=rust
4726 +//! [docs-rs]: https://img.shields.io/badge/docs.rs-66c2a5?style=for-the-badge&labelColor=555555&logoColor=white&logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoIGZpbGw9IiNmNWY1ZjUiIGQ9Ik00ODguNiAyNTAuMkwzOTIgMjE0VjEwNS41YzAtMTUtOS4zLTI4LjQtMjMuNC0zMy43bC0xMDAtMzcuNWMtOC4xLTMuMS0xNy4xLTMuMS0yNS4zIDBsLTEwMCAzNy41Yy0xNC4xIDUuMy0yMy40IDE4LjctMjMuNCAzMy43VjIxNGwtOTYuNiAzNi4yQzkuMyAyNTUuNSAwIDI2OC45IDAgMjgzLjlWMzk0YzAgMTMuNiA3LjcgMjYuMSAxOS45IDMyLjJsMTAwIDUwYzEwLjEgNS4xIDIyLjEgNS4xIDMyLjIgMGwxMDMuOS01MiAxMDMuOSA1MmMxMC4xIDUuMSAyMi4xIDUuMSAzMi4yIDBsMTAwLTUwYzEyLjItNi4xIDE5LjktMTguNiAxOS45LTMyLjJWMjgzLjljMC0xNS05LjMtMjguNC0yMy40LTMzLjd6TTM1OCAyMTQuOGwtODUgMzEuOXYtNjguMmw4NS0zN3Y3My4zek0xNTQgMTA0LjFsMTAyLTM4LjIgMTAyIDM4LjJ2LjZsLTEwMiA0MS40LTEwMi00MS40di0uNnptODQgMjkxLjFsLTg1IDQyLjV2LTc5LjFsODUtMzguOHY3NS40em0wLTExMmwtMTAyIDQxLjQtMTAyLTQxLjR2LS42bDEwMi0zOC4yIDEwMiAzOC4ydi42em0yNDAgMTEybC04NSA0Mi41di03OS4xbDg1LTM4Ljh2NzUuNHptMC0xMTJsLTEwMiA0MS40LTEwMi00MS40di0uNmwxMDItMzguMiAxMDIgMzguMnYuNnoiPjwvcGF0aD48L3N2Zz4K
4728 -//! ## SemVer overview
4730 -//! Given a version number MAJOR.MINOR.PATCH, increment the:
4733 -//! 1. MAJOR version when you make incompatible API changes,
4734 -//! 2. MINOR version when you add functionality in a backwards-compatible
4736 -//! 3. PATCH version when you make backwards-compatible bug fixes.
4738 -//! Additional labels for pre-release and build metadata are available as
4739 -//! extensions to the MAJOR.MINOR.PATCH format.
4741 -//! Any references to 'the spec' in this documentation refer to [version 2.0 of
4742 -//! the SemVer spec](http://semver.org/spec/v2.0.0.html).
4743 +//! A parser and evaluator for Cargo's flavor of Semantic Versioning.
4745 -//! ## SemVer and the Rust ecosystem
4747 -//! Rust itself follows the SemVer specification, as does its standard
4748 -//! libraries. The two are not tied together.
4749 +//! Semantic Versioning (see <https://semver.org>) is a guideline for how
4750 +//! version numbers are assigned and incremented. It is widely followed within
4751 +//! the Cargo/crates.io ecosystem for Rust.
4753 -//! [Cargo](http://crates.io), Rust's package manager, uses SemVer to determine
4754 -//! which versions of packages you need installed.
4759 -//! At its simplest, the `semver` crate allows you to construct `Version`
4760 -//! objects using the `parse` method:
4764 -//! use semver::Version;
4766 +//! use semver::{BuildMetadata, Prerelease, Version, VersionReq};
4768 -//! assert!(Version::parse("1.2.3") == Ok(Version {
4777 -//! If you have multiple `Version`s, you can use the usual comparison operators
4778 -//! to compare them:
4781 -//! use semver::Version;
4783 -//! assert!(Version::parse("1.2.3-alpha") != Version::parse("1.2.3-beta"));
4784 -//! assert!(Version::parse("1.2.3-alpha2") > Version::parse("1.2.0"));
4787 +//! let req = VersionReq::parse(">=1.2.3, <1.8.0").unwrap();
4789 -//! If you explicitly need to modify a Version, SemVer also allows you to
4790 -//! increment the major, minor, and patch numbers in accordance with the spec.
4792 -//! Please note that in order to do this, you must use a mutable Version:
4795 -//! use semver::Version;
4797 -//! let mut bugfix_release = Version::parse("1.0.0").unwrap();
4798 -//! bugfix_release.increment_patch();
4799 +//! // Check whether this requirement matches version 1.2.3-alpha.1 (no)
4800 +//! let version = Version {
4804 +//! pre: Prerelease::new("alpha.1").unwrap(),
4805 +//! build: BuildMetadata::EMPTY,
4807 +//! assert!(!req.matches(&version));
4809 -//! assert_eq!(Ok(bugfix_release), Version::parse("1.0.1"));
4812 -//! When incrementing the minor version number, the patch number resets to zero
4813 -//! (in accordance with section 7 of the spec)
4816 -//! use semver::Version;
4818 -//! let mut feature_release = Version::parse("1.4.6").unwrap();
4819 -//! feature_release.increment_minor();
4821 -//! assert_eq!(Ok(feature_release), Version::parse("1.5.0"));
4822 +//! // Check whether it matches 1.3.0 (yes it does)
4823 +//! let version = Version::parse("1.3.0").unwrap();
4824 +//! assert!(req.matches(&version));
4828 -//! Similarly, when incrementing the major version number, the patch and minor
4829 -//! numbers reset to zero (in accordance with section 8 of the spec)
4833 -//! use semver::Version;
4835 -//! let mut chrome_release = Version::parse("41.5.5377").unwrap();
4836 -//! chrome_release.increment_major();
4837 +//! # Scope of this crate
4839 -//! assert_eq!(Ok(chrome_release), Version::parse("42.0.0"));
4842 -//! ## Requirements
4844 -//! The `semver` crate also provides the ability to compare requirements, which
4845 -//! are more complex comparisons.
4847 -//! For example, creating a requirement that only matches versions greater than
4848 -//! or equal to 1.0.0:
4849 +//! Besides Cargo, several other package ecosystems and package managers for
4850 +//! other languages also use SemVer: RubyGems/Bundler for Ruby, npm for
4851 +//! JavaScript, Composer for PHP, CocoaPods for Objective-C...
4854 -//! # #![allow(unstable)]
4855 -//! use semver::Version;
4856 -//! use semver::VersionReq;
4858 -//! let r = VersionReq::parse(">= 1.0.0").unwrap();
4859 -//! let v = Version::parse("1.0.0").unwrap();
4860 +//! The `semver` crate is specifically intended to implement Cargo's
4861 +//! interpretation of Semantic Versioning.
4863 -//! assert!(r.to_string() == ">= 1.0.0".to_string());
4864 -//! assert!(r.matches(&v))
4867 -//! It also allows parsing of `~x.y.z` and `^x.y.z` requirements as defined at
4868 -//! https://www.npmjs.org/doc/misc/semver.html
4869 +//! Where the various tools differ in their interpretation or implementation of
4870 +//! the spec, this crate follows the implementation choices made by Cargo. If
4871 +//! you are operating on version numbers from some other package ecosystem, you
4872 +//! will want to use a different semver library which is appropriate to that
4875 -//! **Tilde requirements** specify a minimal version with some updates:
4878 -//! ~1.2.3 := >=1.2.3 <1.3.0
4879 -//! ~1.2 := >=1.2.0 <1.3.0
4880 -//! ~1 := >=1.0.0 <2.0.0
4882 +//! The extent of Cargo's SemVer support is documented in the *[Specifying
4883 +//! Dependencies]* chapter of the Cargo reference.
4885 -//! **Caret requirements** allow SemVer compatible updates to a specified
4886 -//! verion, `0.x` and `0.x+1` are not considered compatible, but `1.x` and
4889 -//! `0.0.x` is not considered compatible with any other version.
4890 -//! Missing minor and patch versions are desugared to `0` but allow flexibility
4891 -//! for that value.
4894 -//! ^1.2.3 := >=1.2.3 <2.0.0
4895 -//! ^0.2.3 := >=0.2.3 <0.3.0
4896 -//! ^0.0.3 := >=0.0.3 <0.0.4
4897 -//! ^0.0 := >=0.0.0 <0.1.0
4898 -//! ^0 := >=0.0.0 <1.0.0
4901 -//! **Wildcard requirements** allows parsing of version requirements of the
4902 -//! formats `*`, `x.*` and `x.y.*`.
4906 -//! 1.* := >=1.0.0 <2.0.0
4907 -//! 1.2.* := >=1.2.0 <1.3.0
4909 +//! [Specifying Dependencies]: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html
4911 +#![doc(html_root_url = "https://docs.rs/semver/1.0.9")]
4912 +#![cfg_attr(doc_cfg, feature(doc_cfg))]
4913 +#![cfg_attr(all(not(feature = "std"), not(no_alloc_crate)), no_std)]
4914 +#![cfg_attr(not(no_unsafe_op_in_unsafe_fn_lint), deny(unsafe_op_in_unsafe_fn))]
4915 +#![cfg_attr(no_unsafe_op_in_unsafe_fn_lint, allow(unused_unsafe))]
4916 +#![cfg_attr(no_str_strip_prefix, allow(unstable_name_collisions))]
4918 + clippy::cast_lossless,
4919 + clippy::cast_possible_truncation,
4920 + clippy::doc_markdown,
4921 + clippy::items_after_statements,
4922 + clippy::manual_map,
4923 + clippy::match_bool,
4924 + clippy::missing_errors_doc,
4925 + clippy::must_use_candidate,
4926 + clippy::needless_doctest_main,
4927 + clippy::option_if_let_else,
4928 + clippy::ptr_as_ptr,
4929 + clippy::redundant_else,
4930 + clippy::semicolon_if_nothing_returned, // https://github.com/rust-lang/rust-clippy/issues/7324
4931 + clippy::similar_names,
4932 + clippy::unnested_or_patterns,
4933 + clippy::unseparated_literal_suffix,
4934 + clippy::wildcard_imports
4937 +#[cfg(not(no_alloc_crate))]
4938 +extern crate alloc;
4948 +#[cfg(feature = "serde")]
4951 +use crate::alloc::vec::Vec;
4952 +use crate::identifier::Identifier;
4953 +use core::str::FromStr;
4955 +#[allow(unused_imports)]
4956 +use crate::backport::*;
4958 +pub use crate::parse::Error;
4960 +/// **SemVer version** as defined by <https://semver.org>.
4964 +/// - The major, minor, and patch numbers may be any integer 0 through u64::MAX.
4965 +/// When representing a SemVer version as a string, each number is written as
4966 +/// a base 10 integer. For example, `1.0.119`.
4968 +/// - Leading zeros are forbidden in those positions. For example `1.01.00` is
4969 +/// invalid as a SemVer version.
4971 +/// - The pre-release identifier, if present, must conform to the syntax
4972 +/// documented for [`Prerelease`].
4974 +/// - The build metadata, if present, must conform to the syntax documented for
4975 +/// [`BuildMetadata`].
4977 +/// - Whitespace is not allowed anywhere in the version.
4979 +/// # Total ordering
4981 +/// Given any two SemVer versions, one is less than, greater than, or equal to
4982 +/// the other. Versions may be compared against one another using Rust's usual
4983 +/// comparison operators.
4985 +/// - The major, minor, and patch number are compared numerically from left to
4986 +/// right, lexicographically ordered as a 3-tuple of integers. So for example
4987 +/// version `1.5.0` is less than version `1.19.0`, despite the fact that
4988 +/// "1.19.0" < "1.5.0" as ASCIIbetically compared strings and 1.19 < 1.5
4989 +/// as real numbers.
4991 +/// - When major, minor, and patch are equal, a pre-release version is
4992 +/// considered less than the ordinary release: version `1.0.0-alpha.1` is
4993 +/// less than version `1.0.0`.
4995 +/// - Two pre-releases of the same major, minor, patch are compared by
4996 +/// lexicographic ordering of dot-separated components of the pre-release
4999 +/// - Identifiers consisting of only digits are compared
5000 +/// numerically: `1.0.0-pre.8` is less than `1.0.0-pre.12`.
5002 +/// - Identifiers that contain a letter or hyphen are compared in ASCII sort
5003 +/// order: `1.0.0-pre12` is less than `1.0.0-pre8`.
5005 +/// - Any numeric identifier is always less than any non-numeric
5006 +/// identifier: `1.0.0-pre.1` is less than `1.0.0-pre.x`.
5008 +/// Example: `1.0.0-alpha` < `1.0.0-alpha.1` < `1.0.0-alpha.beta` < `1.0.0-beta` < `1.0.0-beta.2` < `1.0.0-beta.11` < `1.0.0-rc.1` < `1.0.0`
5009 +#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5010 +pub struct Version {
5014 + pub pre: Prerelease,
5015 + pub build: BuildMetadata,
5018 +/// **SemVer version requirement** describing the intersection of some version
5019 +/// comparators, such as `>=1.2.3, <1.8`.
5023 +/// - Either `*` (meaning "any"), or one or more comma-separated comparators.
5025 +/// - A [`Comparator`] is an operator ([`Op`]) and a partial version, separated
5026 +/// by optional whitespace. For example `>=1.0.0` or `>=1.0`.
5028 +/// - Build metadata is syntactically permitted on the partial versions, but is
5029 +/// completely ignored, as it's never relevant to whether any comparator
5030 +/// matches a particular version.
5032 +/// - Whitespace is permitted around commas and around operators. Whitespace is
5033 +/// not permitted within a partial version, i.e. anywhere between the major
5034 +/// version number and its minor, patch, pre-release, or build metadata.
5035 +#[derive(Clone, Eq, PartialEq, Hash, Debug)]
5036 +#[cfg_attr(no_const_vec_new, derive(Default))]
5037 +pub struct VersionReq {
5038 + pub comparators: Vec<Comparator>,
5041 +/// A pair of comparison operator and partial version, such as `>=1.2`. Forms
5042 +/// one piece of a VersionReq.
5043 +#[derive(Clone, Eq, PartialEq, Hash, Debug)]
5044 +pub struct Comparator {
5047 + pub minor: Option<u64>,
5048 + /// Patch is only allowed if minor is Some.
5049 + pub patch: Option<u64>,
5050 + /// Non-empty pre-release is only allowed if patch is Some.
5051 + pub pre: Prerelease,
5054 +/// SemVer comparison operator: `=`, `>`, `>=`, `<`, `<=`, `~`, `^`, `*`.
5057 +/// -  **`=I.J.K`** — exactly the version I.J.K
5058 +/// -  **`=I.J`** — equivalent to `>=I.J.0, <I.(J+1).0`
5059 +/// -  **`=I`** — equivalent to `>=I.0.0, <(I+1).0.0`
5062 +/// -  **`>I.J.K`**
5063 +/// -  **`>I.J`** — equivalent to `>=I.(J+1).0`
5064 +/// -  **`>I`** — equivalent to `>=(I+1).0.0`
5066 +/// # Op::GreaterEq
5067 +/// -  **`>=I.J.K`**
5068 +/// -  **`>=I.J`** — equivalent to `>=I.J.0`
5069 +/// -  **`>=I`** — equivalent to `>=I.0.0`
5072 +/// -  **`<I.J.K`**
5073 +/// -  **`<I.J`** — equivalent to `<I.J.0`
5074 +/// -  **`<I`** — equivalent to `<I.0.0`
5077 +/// -  **`<=I.J.K`**
5078 +/// -  **`<=I.J`** — equivalent to `<I.(J+1).0`
5079 +/// -  **`<=I`** — equivalent to `<(I+1).0.0`
5081 +/// # Op::Tilde ("patch" updates)
5082 +/// *Tilde requirements allow the **patch** part of the semver version (the third number) to increase.*
5083 +/// -  **`~I.J.K`** — equivalent to `>=I.J.K, <I.(J+1).0`
5084 +/// -  **`~I.J`** — equivalent to `=I.J`
5085 +/// -  **`~I`** — equivalent to `=I`
5087 +/// # Op::Caret ("compatible" updates)
5088 +/// *Caret requirements allow parts that are **right of the first nonzero** part of the semver version to increase.*
5089 +/// -  **`^I.J.K`** (for I\>0) — equivalent to `>=I.J.K, <(I+1).0.0`
5090 +/// -  **`^0.J.K`** (for J\>0) — equivalent to `>=0.J.K, <0.(J+1).0`
5091 +/// -  **`^0.0.K`** — equivalent to `=0.0.K`
5092 +/// -  **`^I.J`** (for I\>0 or J\>0) — equivalent to `^I.J.0`
5093 +/// -  **`^0.0`** — equivalent to `=0.0`
5094 +/// -  **`^I`** — equivalent to `=I`
5097 +/// -  **`I.J.*`** — equivalent to `=I.J`
5098 +/// -  **`I.*`** or **`I.*.*`** — equivalent to `=I`
5099 +#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
5100 +#[cfg_attr(not(no_non_exhaustive), non_exhaustive)]
5111 + #[cfg(no_non_exhaustive)] // rustc <1.40
5116 -#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
5117 - html_favicon_url = "https://www.rust-lang.org/favicon.ico")]
5118 -#![deny(missing_docs)]
5119 -#![cfg_attr(test, deny(warnings))]
5120 +/// Optional pre-release identifier on a version string. This comes after `-` in
5121 +/// a SemVer version, like `1.0.0-alpha.1`
5125 +/// Some real world pre-release idioms drawn from crates.io:
5127 +/// - **[mio]** <code>0.7.0-<b>alpha.1</b></code> — the most common style
5128 +/// for numbering pre-releases.
5130 +/// - **[pest]** <code>1.0.0-<b>beta.8</b></code>, <code>1.0.0-<b>rc.0</b></code>
5131 +/// — this crate makes a distinction between betas and release
5134 +/// - **[sassers]** <code>0.11.0-<b>shitshow</b></code> — ???.
5136 +/// - **[atomic-utils]** <code>0.0.0-<b>reserved</b></code> — a squatted
5139 +/// [mio]: https://crates.io/crates/mio
5140 +/// [pest]: https://crates.io/crates/pest
5141 +/// [atomic-utils]: https://crates.io/crates/atomic-utils
5142 +/// [sassers]: https://crates.io/crates/sassers
5144 +/// *Tip:* Be aware that if you are planning to number your own pre-releases,
5145 +/// you should prefer to separate the numeric part from any non-numeric
5146 +/// identifiers by using a dot in between. That is, prefer pre-releases
5147 +/// `alpha.1`, `alpha.2`, etc rather than `alpha1`, `alpha2` etc. The SemVer
5148 +/// spec's rule for pre-release precedence has special treatment of numeric
5149 +/// components in the pre-release string, but only if there are no non-digit
5150 +/// characters in the same dot-separated component. So you'd have `alpha.2` <
5151 +/// `alpha.11` as intended, but `alpha11` < `alpha2`.
5155 +/// Pre-release strings are a series of dot separated identifiers immediately
5156 +/// following the patch version. Identifiers must comprise only ASCII
5157 +/// alphanumerics and hyphens: `0-9`, `A-Z`, `a-z`, `-`. Identifiers must not be
5158 +/// empty. Numeric identifiers must not include leading zeros.
5160 +/// # Total ordering
5162 +/// Pre-releases have a total order defined by the SemVer spec. It uses
5163 +/// lexicographic ordering of dot-separated components. Identifiers consisting
5164 +/// of only digits are compared numerically. Otherwise, identifiers are compared
5165 +/// in ASCII sort order. Any numeric identifier is always less than any
5166 +/// non-numeric identifier.
5168 +/// Example: `alpha` < `alpha.85` < `alpha.90` < `alpha.200` < `alpha.0a` < `alpha.1a0` < `alpha.a` < `beta`
5169 +#[derive(Default, Clone, Eq, PartialEq, Hash)]
5170 +pub struct Prerelease {
5171 + identifier: Identifier,
5174 -extern crate semver_parser;
5176 -// Serialization and deserialization support for version numbers
5177 -#[cfg(feature = "serde")]
5178 -extern crate serde;
5179 +/// Optional build metadata identifier. This comes after `+` in a SemVer
5180 +/// version, as in `0.8.1+zstd.1.5.0`.
5184 +/// Some real world build metadata idioms drawn from crates.io:
5186 +/// - **[libgit2-sys]** <code>0.12.20+<b>1.1.0</b></code> — for this
5187 +/// crate, the build metadata indicates the version of the C libgit2 library
5188 +/// that the Rust crate is built against.
5190 +/// - **[mashup]** <code>0.1.13+<b>deprecated</b></code> — just the word
5191 +/// "deprecated" for a crate that has been superseded by another. Eventually
5192 +/// people will take notice of this in Cargo's build output where it lists the
5193 +/// crates being compiled.
5195 +/// - **[google-bigquery2]** <code>2.0.4+<b>20210327</b></code> — this
5196 +/// library is automatically generated from an official API schema, and the
5197 +/// build metadata indicates the date on which that schema was last captured.
5199 +/// - **[fbthrift-git]** <code>0.0.6+<b>c7fcc0e</b></code> — this crate is
5200 +/// published from snapshots of a big company monorepo. In monorepo
5201 +/// development, there is no concept of versions, and all downstream code is
5202 +/// just updated atomically in the same commit that breaking changes to a
5203 +/// library are landed. Therefore for crates.io purposes, every published
5204 +/// version must be assumed to be incompatible with the previous. The build
5205 +/// metadata provides the source control hash of the snapshotted code.
5207 +/// [libgit2-sys]: https://crates.io/crates/libgit2-sys
5208 +/// [mashup]: https://crates.io/crates/mashup
5209 +/// [google-bigquery2]: https://crates.io/crates/google-bigquery2
5210 +/// [fbthrift-git]: https://crates.io/crates/fbthrift-git
5214 +/// Build metadata is a series of dot separated identifiers immediately
5215 +/// following the patch or pre-release version. Identifiers must comprise only
5216 +/// ASCII alphanumerics and hyphens: `0-9`, `A-Z`, `a-z`, `-`. Identifiers must
5217 +/// not be empty. Leading zeros *are* allowed, unlike any other place in the
5218 +/// SemVer grammar.
5220 +/// # Total ordering
5222 +/// Build metadata is ignored in evaluating `VersionReq`; it plays no role in
5223 +/// whether a `Version` matches any one of the comparison operators.
5225 +/// However for comparing build metadatas among one another, they do have a
5226 +/// total order which is determined by lexicographic ordering of dot-separated
5227 +/// components. Identifiers consisting of only digits are compared numerically.
5228 +/// Otherwise, identifiers are compared in ASCII sort order. Any numeric
5229 +/// identifier is always less than any non-numeric identifier.
5231 +/// Example: `demo` < `demo.85` < `demo.90` < `demo.090` < `demo.200` < `demo.1a0` < `demo.a` < `memo`
5232 +#[derive(Default, Clone, Eq, PartialEq, Hash)]
5233 +pub struct BuildMetadata {
5234 + identifier: Identifier,
5237 -// We take the common approach of keeping our own module system private, and
5238 -// just re-exporting the interface that we want.
5240 + /// Create `Version` with an empty pre-release and build metadata.
5242 + /// Equivalent to:
5245 + /// # use semver::{BuildMetadata, Prerelease, Version};
5247 + /// # const fn new(major: u64, minor: u64, patch: u64) -> Version {
5252 + /// pre: Prerelease::EMPTY,
5253 + /// build: BuildMetadata::EMPTY,
5257 + pub const fn new(major: u64, minor: u64, patch: u64) -> Self {
5262 + pre: Prerelease::EMPTY,
5263 + build: BuildMetadata::EMPTY,
5267 + /// Create `Version` by parsing from string representation.
5271 + /// Possible reasons for the parse to fail include:
5273 + /// - `1.0` — too few numeric components. A SemVer version must have
5274 + /// exactly three. If you are looking at something that has fewer than
5275 + /// three numbers in it, it's possible it is a `VersionReq` instead (with
5276 + /// an implicit default `^` comparison operator).
5278 + /// - `1.0.01` — a numeric component has a leading zero.
5280 + /// - `1.0.unknown` — unexpected character in one of the components.
5282 + /// - `1.0.0-` or `1.0.0+` — the pre-release or build metadata are
5283 + /// indicated present but empty.
5285 + /// - `1.0.0-alpha_123` — pre-release or build metadata have something
5286 + /// outside the allowed characters, which are `0-9`, `A-Z`, `a-z`, `-`,
5287 + /// and `.` (dot).
5289 + /// - `23456789999999999999.0.0` — overflow of a u64.
5290 + pub fn parse(text: &str) -> Result<Self, Error> {
5291 + Version::from_str(text)
5296 + /// A `VersionReq` with no constraint on the version numbers it matches.
5297 + /// Equivalent to `VersionReq::parse("*").unwrap()`.
5299 + /// In terms of comparators this is equivalent to `>=0.0.0`.
5301 + /// Counterintuitively a `*` VersionReq does not match every possible
5302 + /// version number. In particular, in order for *any* `VersionReq` to match
5303 + /// a pre-release version, the `VersionReq` must contain at least one
5304 + /// `Comparator` that has an explicit major, minor, and patch version
5305 + /// identical to the pre-release being matched, and that has a nonempty
5306 + /// pre-release component. Since `*` is not written with an explicit major,
5307 + /// minor, and patch version, and does not contain a nonempty pre-release
5308 + /// component, it does not match any pre-release versions.
5309 + #[cfg(not(no_const_vec_new))] // rustc <1.39
5310 + pub const STAR: Self = VersionReq {
5311 + comparators: Vec::new(),
5314 -pub use version::{Version, Identifier, SemVerError};
5315 -pub use version::Identifier::{Numeric, AlphaNumeric};
5316 -pub use version_req::{VersionReq, ReqParseError};
5317 + /// Create `VersionReq` by parsing from string representation.
5321 + /// Possible reasons for the parse to fail include:
5323 + /// - `>a.b` — unexpected characters in the partial version.
5325 + /// - `@1.0.0` — unrecognized comparison operator.
5327 + /// - `^1.0.0, ` — unexpected end of input.
5329 + /// - `>=1.0 <2.0` — missing comma between comparators.
5331 + /// - `*.*` — unsupported wildcard syntax.
5332 + pub fn parse(text: &str) -> Result<Self, Error> {
5333 + VersionReq::from_str(text)
5336 + /// Evaluate whether the given `Version` satisfies the version requirement
5337 + /// described by `self`.
5338 + pub fn matches(&self, version: &Version) -> bool {
5339 + eval::matches_req(self, version)
5343 +/// The default VersionReq is the same as [`VersionReq::STAR`].
5344 +#[cfg(not(no_const_vec_new))]
5345 +impl Default for VersionReq {
5346 + fn default() -> Self {
5352 + pub fn parse(text: &str) -> Result<Self, Error> {
5353 + Comparator::from_str(text)
5356 -// SemVer-compliant versions.
5358 + pub fn matches(&self, version: &Version) -> bool {
5359 + eval::matches_comparator(self, version)
5364 + pub const EMPTY: Self = Prerelease {
5365 + identifier: Identifier::empty(),
5368 + pub fn new(text: &str) -> Result<Self, Error> {
5369 + Prerelease::from_str(text)
5372 + pub fn as_str(&self) -> &str {
5373 + self.identifier.as_str()
5376 -// advanced version comparisons
5378 + pub fn is_empty(&self) -> bool {
5379 + self.identifier.is_empty()
5383 +impl BuildMetadata {
5384 + pub const EMPTY: Self = BuildMetadata {
5385 + identifier: Identifier::empty(),
5388 + pub fn new(text: &str) -> Result<Self, Error> {
5389 + BuildMetadata::from_str(text)
5392 + pub fn as_str(&self) -> &str {
5393 + self.identifier.as_str()
5396 + pub fn is_empty(&self) -> bool {
5397 + self.identifier.is_empty()
5400 diff --git a/third_party/rust/semver/src/parse.rs b/third_party/rust/semver/src/parse.rs
5401 new file mode 100644
5403 +++ b/third_party/rust/semver/src/parse.rs
5405 +use crate::backport::*;
5406 +use crate::error::{ErrorKind, Position};
5407 +use crate::identifier::Identifier;
5408 +use crate::{BuildMetadata, Comparator, Op, Prerelease, Version, VersionReq};
5409 +use core::str::FromStr;
5411 +/// Error parsing a SemVer version or version requirement.
5416 +/// use semver::Version;
5419 +/// let err = Version::parse("1.q.r").unwrap_err();
5421 +/// // "unexpected character 'q' while parsing minor version number"
5422 +/// eprintln!("{}", err);
5426 + pub(crate) kind: ErrorKind,
5429 +impl FromStr for Version {
5432 + fn from_str(text: &str) -> Result<Self, Self::Err> {
5433 + let mut pos = Position::Major;
5434 + let (major, text) = numeric_identifier(text, pos)?;
5435 + let text = dot(text, pos)?;
5437 + pos = Position::Minor;
5438 + let (minor, text) = numeric_identifier(text, pos)?;
5439 + let text = dot(text, pos)?;
5441 + pos = Position::Patch;
5442 + let (patch, text) = numeric_identifier(text, pos)?;
5444 + if text.is_empty() {
5445 + return Ok(Version::new(major, minor, patch));
5448 + let (pre, text) = if let Some(text) = text.strip_prefix('-') {
5449 + pos = Position::Pre;
5450 + let (pre, text) = prerelease_identifier(text)?;
5451 + if pre.is_empty() {
5452 + return Err(Error::new(ErrorKind::EmptySegment(pos)));
5456 + (Prerelease::EMPTY, text)
5459 + let (build, text) = if let Some(text) = text.strip_prefix('+') {
5460 + pos = Position::Build;
5461 + let (build, text) = build_identifier(text)?;
5462 + if build.is_empty() {
5463 + return Err(Error::new(ErrorKind::EmptySegment(pos)));
5467 + (BuildMetadata::EMPTY, text)
5470 + if let Some(unexpected) = text.chars().next() {
5471 + return Err(Error::new(ErrorKind::UnexpectedCharAfter(pos, unexpected)));
5484 +impl FromStr for VersionReq {
5487 + fn from_str(text: &str) -> Result<Self, Self::Err> {
5488 + let text = text.trim_start_matches(' ');
5489 + if let Some((ch, text)) = wildcard(text) {
5490 + let rest = text.trim_start_matches(' ');
5491 + if rest.is_empty() {
5492 + #[cfg(not(no_const_vec_new))]
5493 + return Ok(VersionReq::STAR);
5494 + #[cfg(no_const_vec_new)] // rustc <1.39
5495 + return Ok(VersionReq {
5496 + comparators: Vec::new(),
5498 + } else if rest.starts_with(',') {
5499 + return Err(Error::new(ErrorKind::WildcardNotTheOnlyComparator(ch)));
5501 + return Err(Error::new(ErrorKind::UnexpectedAfterWildcard));
5506 + let mut comparators = Vec::new();
5507 + let len = version_req(text, &mut comparators, depth)?;
5508 + unsafe { comparators.set_len(len) }
5509 + Ok(VersionReq { comparators })
5513 +impl FromStr for Comparator {
5516 + fn from_str(text: &str) -> Result<Self, Self::Err> {
5517 + let text = text.trim_start_matches(' ');
5518 + let (comparator, pos, rest) = comparator(text)?;
5519 + if !rest.is_empty() {
5520 + let unexpected = rest.chars().next().unwrap();
5521 + return Err(Error::new(ErrorKind::UnexpectedCharAfter(pos, unexpected)));
5527 +impl FromStr for Prerelease {
5530 + fn from_str(text: &str) -> Result<Self, Self::Err> {
5531 + let (pre, rest) = prerelease_identifier(text)?;
5532 + if !rest.is_empty() {
5533 + return Err(Error::new(ErrorKind::IllegalCharacter(Position::Pre)));
5539 +impl FromStr for BuildMetadata {
5542 + fn from_str(text: &str) -> Result<Self, Self::Err> {
5543 + let (build, rest) = build_identifier(text)?;
5544 + if !rest.is_empty() {
5545 + return Err(Error::new(ErrorKind::IllegalCharacter(Position::Build)));
5552 + fn new(kind: ErrorKind) -> Self {
5558 + const DEFAULT: Self = Op::Caret;
5561 +fn numeric_identifier(input: &str, pos: Position) -> Result<(u64, &str), Error> {
5563 + let mut value = 0u64;
5565 + while let Some(&digit) = input.as_bytes().get(len) {
5566 + if digit < b'0' || digit > b'9' {
5569 + if value == 0 && len > 0 {
5570 + return Err(Error::new(ErrorKind::LeadingZero(pos)));
5574 + .and_then(|value| value.checked_add((digit - b'0') as u64))
5576 + Some(sum) => value = sum,
5577 + None => return Err(Error::new(ErrorKind::Overflow(pos))),
5583 + Ok((value, &input[len..]))
5584 + } else if let Some(unexpected) = input[len..].chars().next() {
5585 + Err(Error::new(ErrorKind::UnexpectedChar(pos, unexpected)))
5587 + Err(Error::new(ErrorKind::UnexpectedEnd(pos)))
5591 +fn wildcard(input: &str) -> Option<(char, &str)> {
5592 + if let Some(rest) = input.strip_prefix('*') {
5594 + } else if let Some(rest) = input.strip_prefix('x') {
5596 + } else if let Some(rest) = input.strip_prefix('X') {
5603 +fn dot(input: &str, pos: Position) -> Result<&str, Error> {
5604 + if let Some(rest) = input.strip_prefix('.') {
5606 + } else if let Some(unexpected) = input.chars().next() {
5607 + Err(Error::new(ErrorKind::UnexpectedCharAfter(pos, unexpected)))
5609 + Err(Error::new(ErrorKind::UnexpectedEnd(pos)))
5613 +fn prerelease_identifier(input: &str) -> Result<(Prerelease, &str), Error> {
5614 + let (string, rest) = identifier(input, Position::Pre)?;
5615 + let identifier = unsafe { Identifier::new_unchecked(string) };
5616 + Ok((Prerelease { identifier }, rest))
5619 +fn build_identifier(input: &str) -> Result<(BuildMetadata, &str), Error> {
5620 + let (string, rest) = identifier(input, Position::Build)?;
5621 + let identifier = unsafe { Identifier::new_unchecked(string) };
5622 + Ok((BuildMetadata { identifier }, rest))
5625 +fn identifier(input: &str, pos: Position) -> Result<(&str, &str), Error> {
5626 + let mut accumulated_len = 0;
5627 + let mut segment_len = 0;
5628 + let mut segment_has_nondigit = false;
5631 + match input.as_bytes().get(accumulated_len + segment_len) {
5632 + Some(b'A'..=b'Z') | Some(b'a'..=b'z') | Some(b'-') => {
5634 + segment_has_nondigit = true;
5636 + Some(b'0'..=b'9') => {
5640 + if segment_len == 0 {
5641 + if accumulated_len == 0 && boundary != Some(&b'.') {
5642 + return Ok(("", input));
5644 + return Err(Error::new(ErrorKind::EmptySegment(pos)));
5647 + if pos == Position::Pre
5648 + && segment_len > 1
5649 + && !segment_has_nondigit
5650 + && input[accumulated_len..].starts_with('0')
5652 + return Err(Error::new(ErrorKind::LeadingZero(pos)));
5654 + accumulated_len += segment_len;
5655 + if boundary == Some(&b'.') {
5656 + accumulated_len += 1;
5658 + segment_has_nondigit = false;
5660 + return Ok(input.split_at(accumulated_len));
5667 +fn op(input: &str) -> (Op, &str) {
5668 + let bytes = input.as_bytes();
5669 + if bytes.get(0) == Some(&b'=') {
5670 + (Op::Exact, &input[1..])
5671 + } else if bytes.get(0) == Some(&b'>') {
5672 + if bytes.get(1) == Some(&b'=') {
5673 + (Op::GreaterEq, &input[2..])
5675 + (Op::Greater, &input[1..])
5677 + } else if bytes.get(0) == Some(&b'<') {
5678 + if bytes.get(1) == Some(&b'=') {
5679 + (Op::LessEq, &input[2..])
5681 + (Op::Less, &input[1..])
5683 + } else if bytes.get(0) == Some(&b'~') {
5684 + (Op::Tilde, &input[1..])
5685 + } else if bytes.get(0) == Some(&b'^') {
5686 + (Op::Caret, &input[1..])
5688 + (Op::DEFAULT, input)
5692 +fn comparator(input: &str) -> Result<(Comparator, Position, &str), Error> {
5693 + let (mut op, text) = op(input);
5694 + let default_op = input.len() == text.len();
5695 + let text = text.trim_start_matches(' ');
5697 + let mut pos = Position::Major;
5698 + let (major, text) = numeric_identifier(text, pos)?;
5699 + let mut has_wildcard = false;
5701 + let (minor, text) = if let Some(text) = text.strip_prefix('.') {
5702 + pos = Position::Minor;
5703 + if let Some((_, text)) = wildcard(text) {
5704 + has_wildcard = true;
5706 + op = Op::Wildcard;
5710 + let (minor, text) = numeric_identifier(text, pos)?;
5711 + (Some(minor), text)
5717 + let (patch, text) = if let Some(text) = text.strip_prefix('.') {
5718 + pos = Position::Patch;
5719 + if let Some((_, text)) = wildcard(text) {
5721 + op = Op::Wildcard;
5724 + } else if has_wildcard {
5725 + return Err(Error::new(ErrorKind::UnexpectedAfterWildcard));
5727 + let (patch, text) = numeric_identifier(text, pos)?;
5728 + (Some(patch), text)
5734 + let (pre, text) = if patch.is_some() && text.starts_with('-') {
5735 + pos = Position::Pre;
5736 + let text = &text[1..];
5737 + let (pre, text) = prerelease_identifier(text)?;
5738 + if pre.is_empty() {
5739 + return Err(Error::new(ErrorKind::EmptySegment(pos)));
5743 + (Prerelease::EMPTY, text)
5746 + let text = if patch.is_some() && text.starts_with('+') {
5747 + pos = Position::Build;
5748 + let text = &text[1..];
5749 + let (build, text) = build_identifier(text)?;
5750 + if build.is_empty() {
5751 + return Err(Error::new(ErrorKind::EmptySegment(pos)));
5758 + let text = text.trim_start_matches(' ');
5760 + let comparator = Comparator {
5768 + Ok((comparator, pos, text))
5771 +fn version_req(input: &str, out: &mut Vec<Comparator>, depth: usize) -> Result<usize, Error> {
5772 + let (comparator, pos, text) = match comparator(input) {
5773 + Ok(success) => success,
5774 + Err(mut error) => {
5775 + if let Some((ch, mut rest)) = wildcard(input) {
5776 + rest = rest.trim_start_matches(' ');
5777 + if rest.is_empty() || rest.starts_with(',') {
5778 + error.kind = ErrorKind::WildcardNotTheOnlyComparator(ch);
5781 + return Err(error);
5785 + if text.is_empty() {
5786 + out.reserve_exact(depth + 1);
5787 + unsafe { out.as_mut_ptr().add(depth).write(comparator) }
5788 + return Ok(depth + 1);
5791 + let text = if let Some(text) = text.strip_prefix(',') {
5792 + text.trim_start_matches(' ')
5794 + let unexpected = text.chars().next().unwrap();
5795 + return Err(Error::new(ErrorKind::ExpectedCommaFound(pos, unexpected)));
5798 + const MAX_COMPARATORS: usize = 32;
5799 + if depth + 1 == MAX_COMPARATORS {
5800 + return Err(Error::new(ErrorKind::ExcessiveComparators));
5803 + // Recurse to collect parsed Comparator objects on the stack. We perform a
5804 + // single allocation to allocate exactly the right sized Vec only once the
5805 + // total number of comparators is known.
5806 + let len = version_req(text, out, depth + 1)?;
5807 + unsafe { out.as_mut_ptr().add(depth).write(comparator) }
5810 diff --git a/third_party/rust/semver/src/serde.rs b/third_party/rust/semver/src/serde.rs
5811 new file mode 100644
5813 +++ b/third_party/rust/semver/src/serde.rs
5815 +use crate::{Version, VersionReq};
5817 +use serde::de::{Deserialize, Deserializer, Error, Visitor};
5818 +use serde::ser::{Serialize, Serializer};
5820 +impl Serialize for Version {
5821 + fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
5825 + serializer.collect_str(self)
5829 +impl Serialize for VersionReq {
5830 + fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
5834 + serializer.collect_str(self)
5838 +impl<'de> Deserialize<'de> for Version {
5839 + fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5841 + D: Deserializer<'de>,
5843 + struct VersionVisitor;
5845 + impl<'de> Visitor<'de> for VersionVisitor {
5846 + type Value = Version;
5848 + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
5849 + formatter.write_str("semver version")
5852 + fn visit_str<E>(self, string: &str) -> Result<Self::Value, E>
5856 + string.parse().map_err(Error::custom)
5860 + deserializer.deserialize_str(VersionVisitor)
5864 +impl<'de> Deserialize<'de> for VersionReq {
5865 + fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5867 + D: Deserializer<'de>,
5869 + struct VersionReqVisitor;
5871 + impl<'de> Visitor<'de> for VersionReqVisitor {
5872 + type Value = VersionReq;
5874 + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
5875 + formatter.write_str("semver version")
5878 + fn visit_str<E>(self, string: &str) -> Result<Self::Value, E>
5882 + string.parse().map_err(Error::custom)
5886 + deserializer.deserialize_str(VersionReqVisitor)
5889 diff --git a/third_party/rust/semver/src/version.rs b/third_party/rust/semver/src/version.rs
5890 deleted file mode 100644
5891 --- a/third_party/rust/semver/src/version.rs
5894 -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
5895 -// file at the top-level directory of this distribution and at
5896 -// http://rust-lang.org/COPYRIGHT.
5898 -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5899 -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5900 -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
5901 -// option. This file may not be copied, modified, or distributed
5902 -// except according to those terms.
5904 -//! The `version` module gives you tools to create and compare SemVer-compliant
5907 -use std::cmp::{self, Ordering};
5910 -use std::error::Error;
5917 -#[cfg(feature = "serde")]
5918 -use serde::ser::{Serialize, Serializer};
5919 -#[cfg(feature = "serde")]
5920 -use serde::de::{self, Deserialize, Deserializer, Visitor};
5922 -/// An identifier in the pre-release or build metadata.
5924 -/// See sections 9 and 10 of the spec for more about pre-release identifers and
5925 -/// build metadata.
5926 -#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
5927 -pub enum Identifier {
5928 - /// An identifier that's solely numbers.
5930 - /// An identifier with letters and numbers.
5931 - AlphaNumeric(String),
5934 -impl From<semver_parser::version::Identifier> for Identifier {
5935 - fn from(other: semver_parser::version::Identifier) -> Identifier {
5937 - semver_parser::version::Identifier::Numeric(n) => Identifier::Numeric(n),
5938 - semver_parser::version::Identifier::AlphaNumeric(s) => Identifier::AlphaNumeric(s),
5943 -impl fmt::Display for Identifier {
5945 - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
5947 - Identifier::Numeric(ref n) => fmt::Display::fmt(n, f),
5948 - Identifier::AlphaNumeric(ref s) => fmt::Display::fmt(s, f),
5953 -#[cfg(feature = "serde")]
5954 -impl Serialize for Identifier {
5955 - fn serialize<S>(&self, serializer: S) -> result::Result<S::Ok, S::Error>
5956 - where S: Serializer
5958 - // Serialize Identifier as a number or string.
5960 - Identifier::Numeric(n) => serializer.serialize_u64(n),
5961 - Identifier::AlphaNumeric(ref s) => serializer.serialize_str(s),
5966 -#[cfg(feature = "serde")]
5967 -impl<'de> Deserialize<'de> for Identifier {
5968 - fn deserialize<D>(deserializer: D) -> result::Result<Self, D::Error>
5969 - where D: Deserializer<'de>
5971 - struct IdentifierVisitor;
5973 - // Deserialize Identifier from a number or string.
5974 - impl<'de> Visitor<'de> for IdentifierVisitor {
5975 - type Value = Identifier;
5977 - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
5978 - formatter.write_str("a SemVer pre-release or build identifier")
5981 - fn visit_u64<E>(self, numeric: u64) -> result::Result<Self::Value, E>
5982 - where E: de::Error
5984 - Ok(Identifier::Numeric(numeric))
5987 - fn visit_str<E>(self, alphanumeric: &str) -> result::Result<Self::Value, E>
5988 - where E: de::Error
5990 - Ok(Identifier::AlphaNumeric(alphanumeric.to_owned()))
5994 - deserializer.deserialize_any(IdentifierVisitor)
5998 -/// Represents a version number conforming to the semantic versioning scheme.
5999 -#[derive(Clone, Eq, Debug)]
6000 -pub struct Version {
6001 - /// The major version, to be incremented on incompatible changes.
6003 - /// The minor version, to be incremented when functionality is added in a
6004 - /// backwards-compatible manner.
6006 - /// The patch version, to be incremented when backwards-compatible bug
6007 - /// fixes are made.
6009 - /// The pre-release version identifier, if one exists.
6010 - pub pre: Vec<Identifier>,
6011 - /// The build metadata, ignored when determining version precedence.
6012 - pub build: Vec<Identifier>,
6015 -impl From<semver_parser::version::Version> for Version {
6016 - fn from(other: semver_parser::version::Version) -> Version {
6018 - major: other.major,
6019 - minor: other.minor,
6020 - patch: other.patch,
6021 - pre: other.pre.into_iter().map(From::from).collect(),
6022 - build: other.build.into_iter().map(From::from).collect(),
6027 -#[cfg(feature = "serde")]
6028 -impl Serialize for Version {
6029 - fn serialize<S>(&self, serializer: S) -> result::Result<S::Ok, S::Error>
6030 - where S: Serializer
6032 - // Serialize Version as a string.
6033 - serializer.collect_str(self)
6037 -#[cfg(feature = "serde")]
6038 -impl<'de> Deserialize<'de> for Version {
6039 - fn deserialize<D>(deserializer: D) -> result::Result<Self, D::Error>
6040 - where D: Deserializer<'de>
6042 - struct VersionVisitor;
6044 - // Deserialize Version from a string.
6045 - impl<'de> Visitor<'de> for VersionVisitor {
6046 - type Value = Version;
6048 - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
6049 - formatter.write_str("a SemVer version as a string")
6052 - fn visit_str<E>(self, v: &str) -> result::Result<Self::Value, E>
6053 - where E: de::Error
6055 - Version::parse(v).map_err(de::Error::custom)
6059 - deserializer.deserialize_str(VersionVisitor)
6063 -/// An error type for this crate
6065 -/// Currently, just a generic error. Will make this nicer later.
6066 -#[derive(Clone,PartialEq,Debug,PartialOrd)]
6067 -pub enum SemVerError {
6068 - /// An error ocurred while parsing.
6069 - ParseError(String),
6072 -impl fmt::Display for SemVerError {
6073 - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
6075 - &SemVerError::ParseError(ref m) => write!(f, "{}", m),
6080 -impl Error for SemVerError {
6081 - fn description(&self) -> &str {
6083 - &SemVerError::ParseError(ref m) => m,
6088 -/// A Result type for errors
6089 -pub type Result<T> = result::Result<T, SemVerError>;
6093 - /// Contructs the simple case without pre or build.
6094 - pub fn new(major: u64, minor: u64, patch: u64) -> Version {
6104 - /// Parse a string into a semver object.
6105 - pub fn parse(version: &str) -> Result<Version> {
6106 - let res = semver_parser::version::parse(version);
6109 - // Convert plain String error into proper ParseError
6110 - Err(e) => Err(SemVerError::ParseError(e)),
6111 - Ok(v) => Ok(From::from(v)),
6115 - /// Clears the build metadata
6116 - fn clear_metadata(&mut self) {
6117 - self.build = Vec::new();
6118 - self.pre = Vec::new();
6121 - /// Increments the patch number for this Version (Must be mutable)
6122 - pub fn increment_patch(&mut self) {
6124 - self.clear_metadata();
6127 - /// Increments the minor version number for this Version (Must be mutable)
6129 - /// As instructed by section 7 of the spec, the patch number is reset to 0.
6130 - pub fn increment_minor(&mut self) {
6133 - self.clear_metadata();
6136 - /// Increments the major version number for this Version (Must be mutable)
6138 - /// As instructed by section 8 of the spec, the minor and patch numbers are
6140 - pub fn increment_major(&mut self) {
6144 - self.clear_metadata();
6147 - /// Checks to see if the current Version is in pre-release status
6148 - pub fn is_prerelease(&self) -> bool {
6149 - !self.pre.is_empty()
6153 -impl str::FromStr for Version {
6154 - type Err = SemVerError;
6156 - fn from_str(s: &str) -> Result<Version> {
6161 -impl fmt::Display for Version {
6163 - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
6164 - try!(write!(f, "{}.{}.{}", self.major, self.minor, self.patch));
6165 - if !self.pre.is_empty() {
6166 - try!(write!(f, "-"));
6167 - for (i, x) in self.pre.iter().enumerate() {
6169 - try!(write!(f, "."))
6171 - try!(write!(f, "{}", x));
6174 - if !self.build.is_empty() {
6175 - try!(write!(f, "+"));
6176 - for (i, x) in self.build.iter().enumerate() {
6178 - try!(write!(f, "."))
6180 - try!(write!(f, "{}", x));
6187 -impl cmp::PartialEq for Version {
6189 - fn eq(&self, other: &Version) -> bool {
6190 - // We should ignore build metadata here, otherwise versions v1 and v2
6191 - // can exist such that !(v1 < v2) && !(v1 > v2) && v1 != v2, which
6192 - // violate strict total ordering rules.
6193 - self.major == other.major && self.minor == other.minor && self.patch == other.patch &&
6194 - self.pre == other.pre
6198 -impl cmp::PartialOrd for Version {
6199 - fn partial_cmp(&self, other: &Version) -> Option<Ordering> {
6200 - Some(self.cmp(other))
6204 -impl cmp::Ord for Version {
6205 - fn cmp(&self, other: &Version) -> Ordering {
6206 - match self.major.cmp(&other.major) {
6207 - Ordering::Equal => {}
6211 - match self.minor.cmp(&other.minor) {
6212 - Ordering::Equal => {}
6216 - match self.patch.cmp(&other.patch) {
6217 - Ordering::Equal => {}
6221 - // NB: semver spec says 0.0.0-pre < 0.0.0
6222 - // but the version of ord defined for vec
6223 - // says that [] < [pre] so we alter it here
6224 - match (self.pre.len(), other.pre.len()) {
6225 - (0, 0) => Ordering::Equal,
6226 - (0, _) => Ordering::Greater,
6227 - (_, 0) => Ordering::Less,
6228 - (_, _) => self.pre.cmp(&other.pre),
6233 -impl hash::Hash for Version {
6234 - fn hash<H: hash::Hasher>(&self, into: &mut H) {
6235 - self.major.hash(into);
6236 - self.minor.hash(into);
6237 - self.patch.hash(into);
6238 - self.pre.hash(into);
6242 -impl From<(u64,u64,u64)> for Version {
6243 - fn from(tuple: (u64,u64,u64)) -> Version {
6244 - let (major, minor, patch) = tuple;
6245 - Version::new(major, minor, patch)
6252 - use super::Version;
6253 - use super::Identifier;
6254 - use super::SemVerError;
6258 - fn parse_error(e: &str) -> result::Result<Version, SemVerError> {
6259 - return Err(SemVerError::ParseError(e.to_string()));
6262 - assert_eq!(Version::parse(""),
6263 - parse_error("Error parsing major identifier"));
6264 - assert_eq!(Version::parse(" "),
6265 - parse_error("Error parsing major identifier"));
6266 - assert_eq!(Version::parse("1"),
6267 - parse_error("Expected dot"));
6268 - assert_eq!(Version::parse("1.2"),
6269 - parse_error("Expected dot"));
6270 - assert_eq!(Version::parse("1.2.3-"),
6271 - parse_error("Error parsing prerelease"));
6272 - assert_eq!(Version::parse("a.b.c"),
6273 - parse_error("Error parsing major identifier"));
6274 - assert_eq!(Version::parse("1.2.3 abc"),
6275 - parse_error("Extra junk after valid version: abc"));
6277 - assert_eq!(Version::parse("1.2.3"),
6283 - build: Vec::new(),
6286 - assert_eq!(Version::parse("1.2.3"),
6287 - Ok(Version::new(1,2,3)));
6289 - assert_eq!(Version::parse(" 1.2.3 "),
6295 - build: Vec::new(),
6297 - assert_eq!(Version::parse("1.2.3-alpha1"),
6302 - pre: vec![Identifier::AlphaNumeric(String::from("alpha1"))],
6303 - build: Vec::new(),
6305 - assert_eq!(Version::parse(" 1.2.3-alpha1 "),
6310 - pre: vec![Identifier::AlphaNumeric(String::from("alpha1"))],
6311 - build: Vec::new(),
6313 - assert_eq!(Version::parse("1.2.3+build5"),
6319 - build: vec![Identifier::AlphaNumeric(String::from("build5"))],
6321 - assert_eq!(Version::parse(" 1.2.3+build5 "),
6327 - build: vec![Identifier::AlphaNumeric(String::from("build5"))],
6329 - assert_eq!(Version::parse("1.2.3-alpha1+build5"),
6334 - pre: vec![Identifier::AlphaNumeric(String::from("alpha1"))],
6335 - build: vec![Identifier::AlphaNumeric(String::from("build5"))],
6337 - assert_eq!(Version::parse(" 1.2.3-alpha1+build5 "),
6342 - pre: vec![Identifier::AlphaNumeric(String::from("alpha1"))],
6343 - build: vec![Identifier::AlphaNumeric(String::from("build5"))],
6345 - assert_eq!(Version::parse("1.2.3-1.alpha1.9+build5.7.3aedf "),
6350 - pre: vec![Identifier::Numeric(1),
6351 - Identifier::AlphaNumeric(String::from("alpha1")),
6352 - Identifier::Numeric(9),
6354 - build: vec![Identifier::AlphaNumeric(String::from("build5")),
6355 - Identifier::Numeric(7),
6356 - Identifier::AlphaNumeric(String::from("3aedf")),
6359 - assert_eq!(Version::parse("0.4.0-beta.1+0851523"),
6364 - pre: vec![Identifier::AlphaNumeric(String::from("beta")),
6365 - Identifier::Numeric(1),
6367 - build: vec![Identifier::AlphaNumeric(String::from("0851523"))],
6373 - fn test_increment_patch() {
6374 - let mut buggy_release = Version::parse("0.1.0").unwrap();
6375 - buggy_release.increment_patch();
6376 - assert_eq!(buggy_release, Version::parse("0.1.1").unwrap());
6380 - fn test_increment_minor() {
6381 - let mut feature_release = Version::parse("1.4.6").unwrap();
6382 - feature_release.increment_minor();
6383 - assert_eq!(feature_release, Version::parse("1.5.0").unwrap());
6387 - fn test_increment_major() {
6388 - let mut chrome_release = Version::parse("46.1.246773").unwrap();
6389 - chrome_release.increment_major();
6390 - assert_eq!(chrome_release, Version::parse("47.0.0").unwrap());
6394 - fn test_increment_keep_prerelease() {
6395 - let mut release = Version::parse("1.0.0-alpha").unwrap();
6396 - release.increment_patch();
6398 - assert_eq!(release, Version::parse("1.0.1").unwrap());
6400 - release.increment_minor();
6402 - assert_eq!(release, Version::parse("1.1.0").unwrap());
6404 - release.increment_major();
6406 - assert_eq!(release, Version::parse("2.0.0").unwrap());
6411 - fn test_increment_clear_metadata() {
6412 - let mut release = Version::parse("1.0.0+4442").unwrap();
6413 - release.increment_patch();
6415 - assert_eq!(release, Version::parse("1.0.1").unwrap());
6416 - release = Version::parse("1.0.1+hello").unwrap();
6418 - release.increment_minor();
6420 - assert_eq!(release, Version::parse("1.1.0").unwrap());
6421 - release = Version::parse("1.1.3747+hello").unwrap();
6423 - release.increment_major();
6425 - assert_eq!(release, Version::parse("2.0.0").unwrap());
6430 - assert_eq!(Version::parse("1.2.3"), Version::parse("1.2.3"));
6431 - assert_eq!(Version::parse("1.2.3-alpha1"),
6432 - Version::parse("1.2.3-alpha1"));
6433 - assert_eq!(Version::parse("1.2.3+build.42"),
6434 - Version::parse("1.2.3+build.42"));
6435 - assert_eq!(Version::parse("1.2.3-alpha1+42"),
6436 - Version::parse("1.2.3-alpha1+42"));
6437 - assert_eq!(Version::parse("1.2.3+23"), Version::parse("1.2.3+42"));
6442 - assert!(Version::parse("0.0.0") != Version::parse("0.0.1"));
6443 - assert!(Version::parse("0.0.0") != Version::parse("0.1.0"));
6444 - assert!(Version::parse("0.0.0") != Version::parse("1.0.0"));
6445 - assert!(Version::parse("1.2.3-alpha") != Version::parse("1.2.3-beta"));
6450 - assert_eq!(format!("{}", Version::parse("1.2.3").unwrap()),
6451 - "1.2.3".to_string());
6452 - assert_eq!(format!("{}", Version::parse("1.2.3-alpha1").unwrap()),
6453 - "1.2.3-alpha1".to_string());
6454 - assert_eq!(format!("{}", Version::parse("1.2.3+build.42").unwrap()),
6455 - "1.2.3+build.42".to_string());
6456 - assert_eq!(format!("{}", Version::parse("1.2.3-alpha1+42").unwrap()),
6457 - "1.2.3-alpha1+42".to_string());
6461 - fn test_to_string() {
6462 - assert_eq!(Version::parse("1.2.3").unwrap().to_string(),
6463 - "1.2.3".to_string());
6464 - assert_eq!(Version::parse("1.2.3-alpha1").unwrap().to_string(),
6465 - "1.2.3-alpha1".to_string());
6466 - assert_eq!(Version::parse("1.2.3+build.42").unwrap().to_string(),
6467 - "1.2.3+build.42".to_string());
6468 - assert_eq!(Version::parse("1.2.3-alpha1+42").unwrap().to_string(),
6469 - "1.2.3-alpha1+42".to_string());
6474 - assert!(Version::parse("0.0.0") < Version::parse("1.2.3-alpha2"));
6475 - assert!(Version::parse("1.0.0") < Version::parse("1.2.3-alpha2"));
6476 - assert!(Version::parse("1.2.0") < Version::parse("1.2.3-alpha2"));
6477 - assert!(Version::parse("1.2.3-alpha1") < Version::parse("1.2.3"));
6478 - assert!(Version::parse("1.2.3-alpha1") < Version::parse("1.2.3-alpha2"));
6479 - assert!(!(Version::parse("1.2.3-alpha2") < Version::parse("1.2.3-alpha2")));
6480 - assert!(!(Version::parse("1.2.3+23") < Version::parse("1.2.3+42")));
6485 - assert!(Version::parse("0.0.0") <= Version::parse("1.2.3-alpha2"));
6486 - assert!(Version::parse("1.0.0") <= Version::parse("1.2.3-alpha2"));
6487 - assert!(Version::parse("1.2.0") <= Version::parse("1.2.3-alpha2"));
6488 - assert!(Version::parse("1.2.3-alpha1") <= Version::parse("1.2.3-alpha2"));
6489 - assert!(Version::parse("1.2.3-alpha2") <= Version::parse("1.2.3-alpha2"));
6490 - assert!(Version::parse("1.2.3+23") <= Version::parse("1.2.3+42"));
6495 - assert!(Version::parse("1.2.3-alpha2") > Version::parse("0.0.0"));
6496 - assert!(Version::parse("1.2.3-alpha2") > Version::parse("1.0.0"));
6497 - assert!(Version::parse("1.2.3-alpha2") > Version::parse("1.2.0"));
6498 - assert!(Version::parse("1.2.3-alpha2") > Version::parse("1.2.3-alpha1"));
6499 - assert!(Version::parse("1.2.3") > Version::parse("1.2.3-alpha2"));
6500 - assert!(!(Version::parse("1.2.3-alpha2") > Version::parse("1.2.3-alpha2")));
6501 - assert!(!(Version::parse("1.2.3+23") > Version::parse("1.2.3+42")));
6506 - assert!(Version::parse("1.2.3-alpha2") >= Version::parse("0.0.0"));
6507 - assert!(Version::parse("1.2.3-alpha2") >= Version::parse("1.0.0"));
6508 - assert!(Version::parse("1.2.3-alpha2") >= Version::parse("1.2.0"));
6509 - assert!(Version::parse("1.2.3-alpha2") >= Version::parse("1.2.3-alpha1"));
6510 - assert!(Version::parse("1.2.3-alpha2") >= Version::parse("1.2.3-alpha2"));
6511 - assert!(Version::parse("1.2.3+23") >= Version::parse("1.2.3+42"));
6515 - fn test_prerelease_check() {
6516 - assert!(Version::parse("1.0.0").unwrap().is_prerelease() == false);
6517 - assert!(Version::parse("0.0.1").unwrap().is_prerelease() == false);
6518 - assert!(Version::parse("4.1.4-alpha").unwrap().is_prerelease());
6519 - assert!(Version::parse("1.0.0-beta294296").unwrap().is_prerelease());
6523 - fn test_spec_order() {
6524 - let vs = ["1.0.0-alpha",
6526 - "1.0.0-alpha.beta",
6533 - while i < vs.len() {
6534 - let a = Version::parse(vs[i - 1]);
6535 - let b = Version::parse(vs[i]);
6536 - assert!(a < b, "nope {:?} < {:?}", a, b);
6542 - fn test_from_str() {
6543 - assert_eq!("1.2.3".parse(),
6549 - build: Vec::new(),
6551 - assert_eq!(" 1.2.3 ".parse(),
6557 - build: Vec::new(),
6559 - assert_eq!("1.2.3-alpha1".parse(),
6564 - pre: vec![Identifier::AlphaNumeric(String::from("alpha1"))],
6565 - build: Vec::new(),
6567 - assert_eq!(" 1.2.3-alpha1 ".parse(),
6572 - pre: vec![Identifier::AlphaNumeric(String::from("alpha1"))],
6573 - build: Vec::new(),
6575 - assert_eq!("1.2.3+build5".parse(),
6581 - build: vec![Identifier::AlphaNumeric(String::from("build5"))],
6583 - assert_eq!(" 1.2.3+build5 ".parse(),
6589 - build: vec![Identifier::AlphaNumeric(String::from("build5"))],
6591 - assert_eq!("1.2.3-alpha1+build5".parse(),
6596 - pre: vec![Identifier::AlphaNumeric(String::from("alpha1"))],
6597 - build: vec![Identifier::AlphaNumeric(String::from("build5"))],
6599 - assert_eq!(" 1.2.3-alpha1+build5 ".parse(),
6604 - pre: vec![Identifier::AlphaNumeric(String::from("alpha1"))],
6605 - build: vec![Identifier::AlphaNumeric(String::from("build5"))],
6607 - assert_eq!("1.2.3-1.alpha1.9+build5.7.3aedf ".parse(),
6612 - pre: vec![Identifier::Numeric(1),
6613 - Identifier::AlphaNumeric(String::from("alpha1")),
6614 - Identifier::Numeric(9),
6616 - build: vec![Identifier::AlphaNumeric(String::from("build5")),
6617 - Identifier::Numeric(7),
6618 - Identifier::AlphaNumeric(String::from("3aedf")),
6621 - assert_eq!("0.4.0-beta.1+0851523".parse(),
6626 - pre: vec![Identifier::AlphaNumeric(String::from("beta")),
6627 - Identifier::Numeric(1),
6629 - build: vec![Identifier::AlphaNumeric(String::from("0851523"))],
6635 - fn test_from_str_errors() {
6636 - fn parse_error(e: &str) -> result::Result<Version, SemVerError> {
6637 - return Err(SemVerError::ParseError(e.to_string()));
6640 - assert_eq!("".parse(), parse_error("Error parsing major identifier"));
6641 - assert_eq!(" ".parse(), parse_error("Error parsing major identifier"));
6642 - assert_eq!("1".parse(), parse_error("Expected dot"));
6643 - assert_eq!("1.2".parse(),
6644 - parse_error("Expected dot"));
6645 - assert_eq!("1.2.3-".parse(),
6646 - parse_error("Error parsing prerelease"));
6647 - assert_eq!("a.b.c".parse(),
6648 - parse_error("Error parsing major identifier"));
6649 - assert_eq!("1.2.3 abc".parse(),
6650 - parse_error("Extra junk after valid version: abc"));
6653 diff --git a/third_party/rust/semver/src/version_req.rs b/third_party/rust/semver/src/version_req.rs
6654 deleted file mode 100644
6655 --- a/third_party/rust/semver/src/version_req.rs
6658 -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
6659 -// file at the top-level directory of this distribution and at
6660 -// http://rust-lang.org/COPYRIGHT.
6662 -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6663 -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6664 -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
6665 -// option. This file may not be copied, modified, or distributed
6666 -// except according to those terms.
6668 -use std::error::Error;
6674 -use version::Identifier;
6677 -#[cfg(feature = "serde")]
6678 -use serde::ser::{Serialize, Serializer};
6679 -#[cfg(feature = "serde")]
6680 -use serde::de::{self, Deserialize, Deserializer, Visitor};
6682 -use self::Op::{Ex, Gt, GtEq, Lt, LtEq, Tilde, Compatible, Wildcard};
6683 -use self::WildcardVersion::{Major, Minor, Patch};
6684 -use self::ReqParseError::*;
6686 -/// A `VersionReq` is a struct containing a list of predicates that can apply to ranges of version
6687 -/// numbers. Matching operations can then be done with the `VersionReq` against a particular
6688 -/// version to see if it satisfies some or all of the constraints.
6689 -#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
6690 -pub struct VersionReq {
6691 - predicates: Vec<Predicate>,
6694 -impl From<semver_parser::range::VersionReq> for VersionReq {
6695 - fn from(other: semver_parser::range::VersionReq) -> VersionReq {
6696 - VersionReq { predicates: other.predicates.into_iter().map(From::from).collect() }
6700 -#[cfg(feature = "serde")]
6701 -impl Serialize for VersionReq {
6702 - fn serialize<S>(&self, serializer: S) -> result::Result<S::Ok, S::Error>
6703 - where S: Serializer
6705 - // Serialize VersionReq as a string.
6706 - serializer.collect_str(self)
6710 -#[cfg(feature = "serde")]
6711 -impl<'de> Deserialize<'de> for VersionReq {
6712 - fn deserialize<D>(deserializer: D) -> result::Result<Self, D::Error>
6713 - where D: Deserializer<'de>
6715 - struct VersionReqVisitor;
6717 - /// Deserialize `VersionReq` from a string.
6718 - impl<'de> Visitor<'de> for VersionReqVisitor {
6719 - type Value = VersionReq;
6721 - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
6722 - formatter.write_str("a SemVer version requirement as a string")
6725 - fn visit_str<E>(self, v: &str) -> result::Result<Self::Value, E>
6726 - where E: de::Error
6728 - VersionReq::parse(v).map_err(de::Error::custom)
6732 - deserializer.deserialize_str(VersionReqVisitor)
6736 -#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
6737 -enum WildcardVersion {
6743 -#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
6746 - Gt, // Greater than
6747 - GtEq, // Greater than or equal to
6749 - LtEq, // Less than or equal to
6750 - Tilde, // e.g. ~1.0.0
6751 - Compatible, // compatible by definition of semver, indicated by ^
6752 - Wildcard(WildcardVersion), // x.y.*, x.*, *
6755 -impl From<semver_parser::range::Op> for Op {
6756 - fn from(other: semver_parser::range::Op) -> Op {
6757 - use semver_parser::range;
6759 - range::Op::Ex => Op::Ex,
6760 - range::Op::Gt => Op::Gt,
6761 - range::Op::GtEq => Op::GtEq,
6762 - range::Op::Lt => Op::Lt,
6763 - range::Op::LtEq => Op::LtEq,
6764 - range::Op::Tilde => Op::Tilde,
6765 - range::Op::Compatible => Op::Compatible,
6766 - range::Op::Wildcard(version) => {
6768 - range::WildcardVersion::Major => Op::Wildcard(WildcardVersion::Major),
6769 - range::WildcardVersion::Minor => Op::Wildcard(WildcardVersion::Minor),
6770 - range::WildcardVersion::Patch => Op::Wildcard(WildcardVersion::Patch),
6777 -#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
6781 - minor: Option<u64>,
6782 - patch: Option<u64>,
6783 - pre: Vec<Identifier>,
6786 -impl From<semver_parser::range::Predicate> for Predicate {
6787 - fn from(other: semver_parser::range::Predicate) -> Predicate {
6789 - op: From::from(other.op),
6790 - major: other.major,
6791 - minor: other.minor,
6792 - patch: other.patch,
6793 - pre: other.pre.into_iter().map(From::from).collect(),
6798 -/// A `ReqParseError` is returned from methods which parse a string into a `VersionReq`. Each
6799 -/// enumeration is one of the possible errors that can occur.
6800 -#[derive(Clone, Debug, PartialEq)]
6801 -pub enum ReqParseError {
6802 - /// The given version requirement is invalid.
6803 - InvalidVersionRequirement,
6804 - /// You have already provided an operation, such as `=`, `~`, or `^`. Only use one.
6806 - /// The sigil you have written is not correct.
6808 - /// All components of a version must be numeric.
6809 - VersionComponentsMustBeNumeric,
6810 - /// There was an error parsing an identifier.
6811 - InvalidIdentifier,
6812 - /// At least a major version is required.
6813 - MajorVersionRequired,
6814 - /// An unimplemented version requirement.
6815 - UnimplementedVersionRequirement,
6816 - /// This form of requirement is deprecated.
6817 - DeprecatedVersionRequirement(VersionReq),
6820 -impl fmt::Display for ReqParseError {
6821 - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
6822 - self.description().fmt(f)
6826 -impl Error for ReqParseError {
6827 - fn description(&self) -> &str {
6829 - &InvalidVersionRequirement => "the given version requirement is invalid",
6830 - &OpAlreadySet => {
6831 - "you have already provided an operation, such as =, ~, or ^; only use one"
6833 - &InvalidSigil => "the sigil you have written is not correct",
6834 - &VersionComponentsMustBeNumeric => "version components must be numeric",
6835 - &InvalidIdentifier => "invalid identifier",
6836 - &MajorVersionRequired => "at least a major version number is required",
6837 - &UnimplementedVersionRequirement => {
6838 - "the given version requirement is not implemented, yet"
6840 - &DeprecatedVersionRequirement(_) => "This requirement is deprecated",
6845 -impl From<String> for ReqParseError {
6846 - fn from(other: String) -> ReqParseError {
6848 - "Null is not a valid VersionReq" => ReqParseError::InvalidVersionRequirement,
6849 - "VersionReq did not parse properly." => ReqParseError::OpAlreadySet,
6850 - _ => ReqParseError::InvalidVersionRequirement,
6856 - /// `any()` is a factory method which creates a `VersionReq` with no constraints. In other
6857 - /// words, any version will match against it.
6862 - /// use semver::VersionReq;
6864 - /// let anything = VersionReq::any();
6866 - pub fn any() -> VersionReq {
6867 - VersionReq { predicates: vec![] }
6870 - /// `parse()` is the main constructor of a `VersionReq`. It takes a string like `"^1.2.3"`
6871 - /// and turns it into a `VersionReq` that matches that particular constraint.
6873 - /// A `Result` is returned which contains a `ReqParseError` if there was a problem parsing the
6879 - /// use semver::VersionReq;
6881 - /// let version = VersionReq::parse("=1.2.3");
6882 - /// let version = VersionReq::parse(">1.2.3");
6883 - /// let version = VersionReq::parse("<1.2.3");
6884 - /// let version = VersionReq::parse("~1.2.3");
6885 - /// let version = VersionReq::parse("^1.2.3");
6886 - /// let version = VersionReq::parse("1.2.3"); // synonym for ^1.2.3
6887 - /// let version = VersionReq::parse("<=1.2.3");
6888 - /// let version = VersionReq::parse(">=1.2.3");
6891 - /// This example demonstrates error handling, and will panic.
6893 - /// ```should-panic
6894 - /// use semver::VersionReq;
6896 - /// let version = match VersionReq::parse("not a version") {
6897 - /// Ok(version) => version,
6898 - /// Err(e) => panic!("There was a problem parsing: {}", e),
6901 - pub fn parse(input: &str) -> Result<VersionReq, ReqParseError> {
6902 - let res = semver_parser::range::parse(input);
6904 - if let Ok(v) = res {
6905 - return Ok(From::from(v));
6908 - return match VersionReq::parse_deprecated(input) {
6910 - Err(ReqParseError::DeprecatedVersionRequirement(v))
6912 - None => Err(From::from(res.err().unwrap())),
6916 - fn parse_deprecated(version: &str) -> Option<VersionReq> {
6917 - return match version {
6918 - ".*" => Some(VersionReq::any()),
6919 - "0.1.0." => Some(VersionReq::parse("0.1.0").unwrap()),
6920 - "0.3.1.3" => Some(VersionReq::parse("0.3.13").unwrap()),
6921 - "0.2*" => Some(VersionReq::parse("0.2.*").unwrap()),
6922 - "*.0" => Some(VersionReq::any()),
6927 - /// `exact()` is a factory method which creates a `VersionReq` with one exact constraint.
6932 - /// use semver::VersionReq;
6933 - /// use semver::Version;
6935 - /// let version = Version { major: 1, minor: 1, patch: 1, pre: vec![], build: vec![] };
6936 - /// let exact = VersionReq::exact(&version);
6938 - pub fn exact(version: &Version) -> VersionReq {
6939 - VersionReq { predicates: vec![Predicate::exact(version)] }
6942 - /// `matches()` matches a given `Version` against this `VersionReq`.
6947 - /// use semver::VersionReq;
6948 - /// use semver::Version;
6950 - /// let version = Version { major: 1, minor: 1, patch: 1, pre: vec![], build: vec![] };
6951 - /// let exact = VersionReq::exact(&version);
6953 - /// assert!(exact.matches(&version));
6955 - pub fn matches(&self, version: &Version) -> bool {
6956 - // no predicates means anything matches
6957 - if self.predicates.is_empty() {
6961 - self.predicates.iter().all(|p| p.matches(version)) &&
6962 - self.predicates.iter().any(|p| p.pre_tag_is_compatible(version))
6966 -impl str::FromStr for VersionReq {
6967 - type Err = ReqParseError;
6969 - fn from_str(s: &str) -> Result<VersionReq, ReqParseError> {
6970 - VersionReq::parse(s)
6975 - fn exact(version: &Version) -> Predicate {
6978 - major: version.major,
6979 - minor: Some(version.minor),
6980 - patch: Some(version.patch),
6981 - pre: version.pre.clone(),
6985 - /// `matches()` takes a `Version` and determines if it matches this particular `Predicate`.
6986 - pub fn matches(&self, ver: &Version) -> bool {
6988 - Ex => self.is_exact(ver),
6989 - Gt => self.is_greater(ver),
6990 - GtEq => self.is_exact(ver) || self.is_greater(ver),
6991 - Lt => !self.is_exact(ver) && !self.is_greater(ver),
6992 - LtEq => !self.is_greater(ver),
6993 - Tilde => self.matches_tilde(ver),
6994 - Compatible => self.is_compatible(ver),
6995 - Wildcard(_) => self.matches_wildcard(ver),
6999 - fn is_exact(&self, ver: &Version) -> bool {
7000 - if self.major != ver.major {
7004 - match self.minor {
7006 - if minor != ver.minor {
7010 - None => return true,
7013 - match self.patch {
7015 - if patch != ver.patch {
7019 - None => return true,
7022 - if self.pre != ver.pre {
7029 - // https://docs.npmjs.com/misc/semver#prerelease-tags
7030 - fn pre_tag_is_compatible(&self, ver: &Version) -> bool {
7031 - // If a version has a prerelease tag (for example, 1.2.3-alpha.3) then it will
7033 - // allowed to satisfy comparator sets if at least one comparator with the same
7035 - // minor, patch] tuple also has a prerelease tag.
7036 - !ver.is_prerelease() ||
7037 - (self.major == ver.major && self.minor == Some(ver.minor) &&
7038 - self.patch == Some(ver.patch) && !self.pre.is_empty())
7041 - fn is_greater(&self, ver: &Version) -> bool {
7042 - if self.major != ver.major {
7043 - return ver.major > self.major;
7046 - match self.minor {
7048 - if minor != ver.minor {
7049 - return ver.minor > minor;
7052 - None => return false,
7055 - match self.patch {
7057 - if patch != ver.patch {
7058 - return ver.patch > patch;
7061 - None => return false,
7064 - if !self.pre.is_empty() {
7065 - return ver.pre.is_empty() || ver.pre > self.pre;
7071 - // see https://www.npmjs.org/doc/misc/semver.html for behavior
7072 - fn matches_tilde(&self, ver: &Version) -> bool {
7073 - let minor = match self.minor {
7075 - None => return self.major == ver.major,
7078 - match self.patch {
7080 - self.major == ver.major && minor == ver.minor &&
7081 - (ver.patch > patch || (ver.patch == patch && self.pre_is_compatible(ver)))
7083 - None => self.major == ver.major && minor == ver.minor,
7087 - // see https://www.npmjs.org/doc/misc/semver.html for behavior
7088 - fn is_compatible(&self, ver: &Version) -> bool {
7089 - if self.major != ver.major {
7093 - let minor = match self.minor {
7095 - None => return self.major == ver.major,
7098 - match self.patch {
7100 - if self.major == 0 {
7102 - ver.minor == minor && ver.patch == patch && self.pre_is_compatible(ver)
7104 - ver.minor == minor &&
7105 - (ver.patch > patch || (ver.patch == patch && self.pre_is_compatible(ver)))
7108 - ver.minor > minor ||
7109 - (ver.minor == minor &&
7110 - (ver.patch > patch || (ver.patch == patch && self.pre_is_compatible(ver))))
7114 - if self.major == 0 {
7115 - ver.minor == minor
7117 - ver.minor >= minor
7123 - fn pre_is_compatible(&self, ver: &Version) -> bool {
7124 - ver.pre.is_empty() || ver.pre >= self.pre
7127 - // see https://www.npmjs.org/doc/misc/semver.html for behavior
7128 - fn matches_wildcard(&self, ver: &Version) -> bool {
7130 - Wildcard(Major) => true,
7131 - Wildcard(Minor) => self.major == ver.major,
7132 - Wildcard(Patch) => {
7133 - match self.minor {
7134 - Some(minor) => self.major == ver.major && minor == ver.minor,
7136 - // minor and patch version astericks mean match on major
7137 - self.major == ver.major
7141 - _ => false, // unreachable
7146 -impl fmt::Display for VersionReq {
7147 - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
7148 - if self.predicates.is_empty() {
7149 - try!(write!(fmt, "*"));
7151 - for (i, ref pred) in self.predicates.iter().enumerate() {
7153 - try!(write!(fmt, "{}", pred));
7155 - try!(write!(fmt, ", {}", pred));
7164 -impl fmt::Display for Predicate {
7165 - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
7167 - Wildcard(Major) => try!(write!(fmt, "*")),
7168 - Wildcard(Minor) => try!(write!(fmt, "{}.*", self.major)),
7169 - Wildcard(Patch) => {
7170 - if let Some(minor) = self.minor {
7171 - try!(write!(fmt, "{}.{}.*", self.major, minor))
7173 - try!(write!(fmt, "{}.*.*", self.major))
7177 - try!(write!(fmt, "{}{}", self.op, self.major));
7179 - match self.minor {
7180 - Some(v) => try!(write!(fmt, ".{}", v)),
7184 - match self.patch {
7185 - Some(v) => try!(write!(fmt, ".{}", v)),
7189 - if !self.pre.is_empty() {
7190 - try!(write!(fmt, "-"));
7191 - for (i, x) in self.pre.iter().enumerate() {
7193 - try!(write!(fmt, "."))
7195 - try!(write!(fmt, "{}", x));
7205 -impl fmt::Display for Op {
7206 - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
7208 - Ex => try!(write!(fmt, "= ")),
7209 - Gt => try!(write!(fmt, "> ")),
7210 - GtEq => try!(write!(fmt, ">= ")),
7211 - Lt => try!(write!(fmt, "< ")),
7212 - LtEq => try!(write!(fmt, "<= ")),
7213 - Tilde => try!(write!(fmt, "~")),
7214 - Compatible => try!(write!(fmt, "^")),
7215 - // gets handled specially in Predicate::fmt
7216 - Wildcard(_) => try!(write!(fmt, "")),
7224 - use super::{VersionReq, Op};
7225 - use super::super::version::Version;
7226 - use std::hash::{Hash, Hasher};
7228 - fn req(s: &str) -> VersionReq {
7229 - VersionReq::parse(s).unwrap()
7232 - fn version(s: &str) -> Version {
7233 - match Version::parse(s) {
7235 - Err(e) => panic!("`{}` is not a valid version. Reason: {:?}", s, e),
7239 - fn assert_match(req: &VersionReq, vers: &[&str]) {
7240 - for ver in vers.iter() {
7241 - assert!(req.matches(&version(*ver)), "did not match {}", ver);
7245 - fn assert_not_match(req: &VersionReq, vers: &[&str]) {
7246 - for ver in vers.iter() {
7247 - assert!(!req.matches(&version(*ver)), "matched {}", ver);
7251 - fn calculate_hash<T: Hash>(t: T) -> u64 {
7252 - use std::collections::hash_map::DefaultHasher;
7254 - let mut s = DefaultHasher::new();
7260 - fn test_parsing_default() {
7261 - let r = req("1.0.0");
7263 - assert_eq!(r.to_string(), "^1.0.0".to_string());
7265 - assert_match(&r, &["1.0.0", "1.0.1"]);
7266 - assert_not_match(&r, &["0.9.9", "0.10.0", "0.1.0"]);
7270 - fn test_parsing_exact() {
7271 - let r = req("=1.0.0");
7273 - assert!(r.to_string() == "= 1.0.0".to_string());
7274 - assert_eq!(r.to_string(), "= 1.0.0".to_string());
7276 - assert_match(&r, &["1.0.0"]);
7277 - assert_not_match(&r, &["1.0.1", "0.9.9", "0.10.0", "0.1.0", "1.0.0-pre"]);
7279 - let r = req("=0.9.0");
7281 - assert_eq!(r.to_string(), "= 0.9.0".to_string());
7283 - assert_match(&r, &["0.9.0"]);
7284 - assert_not_match(&r, &["0.9.1", "1.9.0", "0.0.9"]);
7286 - let r = req("=0.1.0-beta2.a");
7288 - assert_eq!(r.to_string(), "= 0.1.0-beta2.a".to_string());
7290 - assert_match(&r, &["0.1.0-beta2.a"]);
7291 - assert_not_match(&r, &["0.9.1", "0.1.0", "0.1.1-beta2.a", "0.1.0-beta2"]);
7295 - fn test_parse_metadata_see_issue_88_see_issue_88() {
7296 - for op in &[Op::Compatible, Op::Ex, Op::Gt, Op::GtEq, Op::Lt, Op::LtEq, Op::Tilde] {
7297 - req(&format!("{} 1.2.3+meta", op));
7302 - pub fn test_parsing_greater_than() {
7303 - let r = req(">= 1.0.0");
7305 - assert_eq!(r.to_string(), ">= 1.0.0".to_string());
7307 - assert_match(&r, &["1.0.0", "2.0.0"]);
7308 - assert_not_match(&r, &["0.1.0", "0.0.1", "1.0.0-pre", "2.0.0-pre"]);
7310 - let r = req(">= 2.1.0-alpha2");
7312 - assert_match(&r, &["2.1.0-alpha2", "2.1.0-alpha3", "2.1.0", "3.0.0"]);
7313 - assert_not_match(&r,
7314 - &["2.0.0", "2.1.0-alpha1", "2.0.0-alpha2", "3.0.0-alpha2"]);
7318 - pub fn test_parsing_less_than() {
7319 - let r = req("< 1.0.0");
7321 - assert_eq!(r.to_string(), "< 1.0.0".to_string());
7323 - assert_match(&r, &["0.1.0", "0.0.1"]);
7324 - assert_not_match(&r, &["1.0.0", "1.0.0-beta", "1.0.1", "0.9.9-alpha"]);
7326 - let r = req("<= 2.1.0-alpha2");
7328 - assert_match(&r, &["2.1.0-alpha2", "2.1.0-alpha1", "2.0.0", "1.0.0"]);
7329 - assert_not_match(&r,
7330 - &["2.1.0", "2.2.0-alpha1", "2.0.0-alpha2", "1.0.0-alpha2"]);
7334 - pub fn test_multiple() {
7335 - let r = req("> 0.0.9, <= 2.5.3");
7336 - assert_eq!(r.to_string(), "> 0.0.9, <= 2.5.3".to_string());
7337 - assert_match(&r, &["0.0.10", "1.0.0", "2.5.3"]);
7338 - assert_not_match(&r, &["0.0.8", "2.5.4"]);
7340 - let r = req("0.3.0, 0.4.0");
7341 - assert_eq!(r.to_string(), "^0.3.0, ^0.4.0".to_string());
7342 - assert_not_match(&r, &["0.0.8", "0.3.0", "0.4.0"]);
7344 - let r = req("<= 0.2.0, >= 0.5.0");
7345 - assert_eq!(r.to_string(), "<= 0.2.0, >= 0.5.0".to_string());
7346 - assert_not_match(&r, &["0.0.8", "0.3.0", "0.5.1"]);
7348 - let r = req("0.1.0, 0.1.4, 0.1.6");
7349 - assert_eq!(r.to_string(), "^0.1.0, ^0.1.4, ^0.1.6".to_string());
7350 - assert_match(&r, &["0.1.6", "0.1.9"]);
7351 - assert_not_match(&r, &["0.1.0", "0.1.4", "0.2.0"]);
7353 - assert!(VersionReq::parse("> 0.1.0,").is_err());
7354 - assert!(VersionReq::parse("> 0.3.0, ,").is_err());
7356 - let r = req(">=0.5.1-alpha3, <0.6");
7357 - assert_eq!(r.to_string(), ">= 0.5.1-alpha3, < 0.6".to_string());
7359 - &["0.5.1-alpha3", "0.5.1-alpha4", "0.5.1-beta", "0.5.1", "0.5.5"]);
7360 - assert_not_match(&r,
7361 - &["0.5.1-alpha1", "0.5.2-alpha3", "0.5.5-pre", "0.5.0-pre"]);
7362 - assert_not_match(&r, &["0.6.0", "0.6.0-pre"]);
7366 - pub fn test_parsing_tilde() {
7367 - let r = req("~1");
7368 - assert_match(&r, &["1.0.0", "1.0.1", "1.1.1"]);
7369 - assert_not_match(&r, &["0.9.1", "2.9.0", "0.0.9"]);
7371 - let r = req("~1.2");
7372 - assert_match(&r, &["1.2.0", "1.2.1"]);
7373 - assert_not_match(&r, &["1.1.1", "1.3.0", "0.0.9"]);
7375 - let r = req("~1.2.2");
7376 - assert_match(&r, &["1.2.2", "1.2.4"]);
7377 - assert_not_match(&r, &["1.2.1", "1.9.0", "1.0.9", "2.0.1", "0.1.3"]);
7379 - let r = req("~1.2.3-beta.2");
7380 - assert_match(&r, &["1.2.3", "1.2.4", "1.2.3-beta.2", "1.2.3-beta.4"]);
7381 - assert_not_match(&r, &["1.3.3", "1.1.4", "1.2.3-beta.1", "1.2.4-beta.2"]);
7385 - pub fn test_parsing_compatible() {
7386 - let r = req("^1");
7387 - assert_match(&r, &["1.1.2", "1.1.0", "1.2.1", "1.0.1"]);
7388 - assert_not_match(&r, &["0.9.1", "2.9.0", "0.1.4"]);
7389 - assert_not_match(&r, &["1.0.0-beta1", "0.1.0-alpha", "1.0.1-pre"]);
7391 - let r = req("^1.1");
7392 - assert_match(&r, &["1.1.2", "1.1.0", "1.2.1"]);
7393 - assert_not_match(&r, &["0.9.1", "2.9.0", "1.0.1", "0.1.4"]);
7395 - let r = req("^1.1.2");
7396 - assert_match(&r, &["1.1.2", "1.1.4", "1.2.1"]);
7397 - assert_not_match(&r, &["0.9.1", "2.9.0", "1.1.1", "0.0.1"]);
7398 - assert_not_match(&r, &["1.1.2-alpha1", "1.1.3-alpha1", "2.9.0-alpha1"]);
7400 - let r = req("^0.1.2");
7401 - assert_match(&r, &["0.1.2", "0.1.4"]);
7402 - assert_not_match(&r, &["0.9.1", "2.9.0", "1.1.1", "0.0.1"]);
7403 - assert_not_match(&r, &["0.1.2-beta", "0.1.3-alpha", "0.2.0-pre"]);
7405 - let r = req("^0.5.1-alpha3");
7407 - &["0.5.1-alpha3", "0.5.1-alpha4", "0.5.1-beta", "0.5.1", "0.5.5"]);
7408 - assert_not_match(&r,
7409 - &["0.5.1-alpha1", "0.5.2-alpha3", "0.5.5-pre", "0.5.0-pre", "0.6.0"]);
7411 - let r = req("^0.0.2");
7412 - assert_match(&r, &["0.0.2"]);
7413 - assert_not_match(&r, &["0.9.1", "2.9.0", "1.1.1", "0.0.1", "0.1.4"]);
7415 - let r = req("^0.0");
7416 - assert_match(&r, &["0.0.2", "0.0.0"]);
7417 - assert_not_match(&r, &["0.9.1", "2.9.0", "1.1.1", "0.1.4"]);
7419 - let r = req("^0");
7420 - assert_match(&r, &["0.9.1", "0.0.2", "0.0.0"]);
7421 - assert_not_match(&r, &["2.9.0", "1.1.1"]);
7423 - let r = req("^1.4.2-beta.5");
7425 - &["1.4.2", "1.4.3", "1.4.2-beta.5", "1.4.2-beta.6", "1.4.2-c"]);
7426 - assert_not_match(&r,
7427 - &["0.9.9", "2.0.0", "1.4.2-alpha", "1.4.2-beta.4", "1.4.3-beta.5"]);
7431 - pub fn test_parsing_wildcard() {
7433 - assert_match(&r, &["0.9.1", "2.9.0", "0.0.9", "1.0.1", "1.1.1"]);
7434 - assert_not_match(&r, &[]);
7436 - assert_match(&r, &["0.9.1", "2.9.0", "0.0.9", "1.0.1", "1.1.1"]);
7437 - assert_not_match(&r, &[]);
7439 - assert_match(&r, &["0.9.1", "2.9.0", "0.0.9", "1.0.1", "1.1.1"]);
7440 - assert_not_match(&r, &[]);
7442 - assert_match(&r, &["0.9.1", "2.9.0", "0.0.9", "1.0.1", "1.1.1"]);
7443 - assert_not_match(&r, &[]);
7445 - let r = req("1.*");
7446 - assert_match(&r, &["1.2.0", "1.2.1", "1.1.1", "1.3.0"]);
7447 - assert_not_match(&r, &["0.0.9"]);
7448 - let r = req("1.x");
7449 - assert_match(&r, &["1.2.0", "1.2.1", "1.1.1", "1.3.0"]);
7450 - assert_not_match(&r, &["0.0.9"]);
7451 - let r = req("1.X");
7452 - assert_match(&r, &["1.2.0", "1.2.1", "1.1.1", "1.3.0"]);
7453 - assert_not_match(&r, &["0.0.9"]);
7455 - let r = req("1.2.*");
7456 - assert_match(&r, &["1.2.0", "1.2.2", "1.2.4"]);
7457 - assert_not_match(&r, &["1.9.0", "1.0.9", "2.0.1", "0.1.3"]);
7458 - let r = req("1.2.x");
7459 - assert_match(&r, &["1.2.0", "1.2.2", "1.2.4"]);
7460 - assert_not_match(&r, &["1.9.0", "1.0.9", "2.0.1", "0.1.3"]);
7461 - let r = req("1.2.X");
7462 - assert_match(&r, &["1.2.0", "1.2.2", "1.2.4"]);
7463 - assert_not_match(&r, &["1.9.0", "1.0.9", "2.0.1", "0.1.3"]);
7467 - pub fn test_any() {
7468 - let r = VersionReq::any();
7469 - assert_match(&r, &["0.0.1", "0.1.0", "1.0.0"]);
7473 - pub fn test_pre() {
7474 - let r = req("=2.1.1-really.0");
7475 - assert_match(&r, &["2.1.1-really.0"]);
7479 - // pub fn test_parse_errors() {
7480 - // assert_eq!(Err(InvalidVersionRequirement), VersionReq::parse("\0"));
7481 - // assert_eq!(Err(OpAlreadySet), VersionReq::parse(">= >= 0.0.2"));
7482 - // assert_eq!(Err(InvalidSigil), VersionReq::parse(">== 0.0.2"));
7483 - // assert_eq!(Err(VersionComponentsMustBeNumeric),
7484 - // VersionReq::parse("a.0.0"));
7485 - // assert_eq!(Err(InvalidIdentifier), VersionReq::parse("1.0.0-"));
7486 - // assert_eq!(Err(MajorVersionRequired), VersionReq::parse(">="));
7490 - pub fn test_from_str() {
7491 - assert_eq!("1.0.0".parse::<VersionReq>().unwrap().to_string(),
7492 - "^1.0.0".to_string());
7493 - assert_eq!("=1.0.0".parse::<VersionReq>().unwrap().to_string(),
7494 - "= 1.0.0".to_string());
7495 - assert_eq!("~1".parse::<VersionReq>().unwrap().to_string(),
7496 - "~1".to_string());
7497 - assert_eq!("~1.2".parse::<VersionReq>().unwrap().to_string(),
7498 - "~1.2".to_string());
7499 - assert_eq!("^1".parse::<VersionReq>().unwrap().to_string(),
7500 - "^1".to_string());
7501 - assert_eq!("^1.1".parse::<VersionReq>().unwrap().to_string(),
7502 - "^1.1".to_string());
7503 - assert_eq!("*".parse::<VersionReq>().unwrap().to_string(),
7505 - assert_eq!("1.*".parse::<VersionReq>().unwrap().to_string(),
7506 - "1.*".to_string());
7507 - assert_eq!("< 1.0.0".parse::<VersionReq>().unwrap().to_string(),
7508 - "< 1.0.0".to_string());
7512 - // pub fn test_from_str_errors() {
7513 - // assert_eq!(Err(InvalidVersionRequirement), "\0".parse::<VersionReq>());
7514 - // assert_eq!(Err(OpAlreadySet), ">= >= 0.0.2".parse::<VersionReq>());
7515 - // assert_eq!(Err(InvalidSigil), ">== 0.0.2".parse::<VersionReq>());
7516 - // assert_eq!(Err(VersionComponentsMustBeNumeric),
7517 - // "a.0.0".parse::<VersionReq>());
7518 - // assert_eq!(Err(InvalidIdentifier), "1.0.0-".parse::<VersionReq>());
7519 - // assert_eq!(Err(MajorVersionRequired), ">=".parse::<VersionReq>());
7523 - fn test_cargo3202() {
7524 - let v = "0.*.*".parse::<VersionReq>().unwrap();
7525 - assert_eq!("0.*.*", format!("{}", v.predicates[0]));
7527 - let v = "0.0.*".parse::<VersionReq>().unwrap();
7528 - assert_eq!("0.0.*", format!("{}", v.predicates[0]));
7530 - let r = req("0.*.*");
7531 - assert_match(&r, &["0.5.0"]);
7535 - fn test_eq_hash() {
7536 - assert!(req("^1") == req("^1"));
7537 - assert!(calculate_hash(req("^1")) == calculate_hash(req("^1")));
7538 - assert!(req("^1") != req("^2"));
7542 - fn test_ordering() {
7543 - assert!(req("=1") < req("*"));
7544 - assert!(req(">1") < req("*"));
7545 - assert!(req(">=1") < req("*"));
7546 - assert!(req("<1") < req("*"));
7547 - assert!(req("<=1") < req("*"));
7548 - assert!(req("~1") < req("*"));
7549 - assert!(req("^1") < req("*"));
7550 - assert!(req("*") == req("*"));
7553 diff --git a/third_party/rust/semver/tests/deprecation.rs b/third_party/rust/semver/tests/deprecation.rs
7554 deleted file mode 100644
7555 --- a/third_party/rust/semver/tests/deprecation.rs
7558 -extern crate semver;
7561 -fn test_regressions() {
7562 - use semver::VersionReq;
7563 - use semver::ReqParseError;
7565 - let versions = vec![
7566 - (".*", VersionReq::any()),
7567 - ("0.1.0.", VersionReq::parse("0.1.0").unwrap()),
7568 - ("0.3.1.3", VersionReq::parse("0.3.13").unwrap()),
7569 - ("0.2*", VersionReq::parse("0.2.*").unwrap()),
7570 - ("*.0", VersionReq::any()),
7573 - for (version, requirement) in versions.into_iter() {
7574 - let parsed = VersionReq::parse(version);
7575 - let error = parsed.err().unwrap();
7577 - assert_eq!(ReqParseError::DeprecatedVersionRequirement(requirement), error);
7580 diff --git a/third_party/rust/semver/tests/node/mod.rs b/third_party/rust/semver/tests/node/mod.rs
7581 new file mode 100644
7583 +++ b/third_party/rust/semver/tests/node/mod.rs
7585 +#![cfg(test_node_semver)]
7587 +use semver::Version;
7588 +use std::fmt::{self, Display};
7589 +use std::process::Command;
7591 +#[derive(Default, Eq, PartialEq, Hash, Debug)]
7592 +pub(super) struct VersionReq(semver::VersionReq);
7595 + pub(super) const STAR: Self = VersionReq(semver::VersionReq::STAR);
7597 + pub(super) fn matches(&self, version: &Version) -> bool {
7598 + let out = Command::new("node")
7601 + "console.log(require('semver').satisfies('{}', '{}'))",
7603 + self.to_string().replace(',', ""),
7607 + if out.stdout == b"true\n" {
7609 + } else if out.stdout == b"false\n" {
7612 + let s = String::from_utf8_lossy(&out.stdout) + String::from_utf8_lossy(&out.stderr);
7613 + panic!("unexpected output: {}", s);
7618 +impl Display for VersionReq {
7619 + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
7620 + Display::fmt(&self.0, formatter)
7624 +#[cfg_attr(not(no_track_caller), track_caller)]
7625 +pub(super) fn req(text: &str) -> VersionReq {
7626 + VersionReq(crate::util::req(text))
7628 diff --git a/third_party/rust/semver/tests/regression.rs b/third_party/rust/semver/tests/regression.rs
7629 deleted file mode 100644
7630 --- a/third_party/rust/semver/tests/regression.rs
7633 -extern crate semver;
7634 -extern crate crates_index;
7635 -extern crate tempdir;
7637 -// This test checks to see if every existing crate parses successfully. Important to not break the
7640 -#[cfg(feature = "ci")]
7642 -fn test_regressions() {
7643 - use tempdir::TempDir;
7644 - use crates_index::Index;
7645 - use semver::Version;
7647 - let dir = TempDir::new("semver").unwrap();
7648 - let index = Index::new(dir.into_path());
7649 - index.clone().unwrap();
7651 - for krate in index.crates() {
7652 - for version in krate.versions() {
7653 - let v = version.version();
7654 - assert!(Version::parse(v).is_ok(), "failed: {} ({})", version.name(), v);
7658 diff --git a/third_party/rust/semver/tests/serde.rs b/third_party/rust/semver/tests/serde.rs
7659 deleted file mode 100644
7660 --- a/third_party/rust/semver/tests/serde.rs
7663 -#![cfg(feature = "serde")]
7666 -extern crate serde_derive;
7668 -extern crate semver;
7669 -extern crate serde_json;
7671 -use semver::{Identifier, Version, VersionReq};
7673 -#[derive(Serialize, Deserialize, PartialEq, Debug)]
7674 -struct Identified {
7676 - identifier: Identifier,
7679 -#[derive(Serialize, Deserialize, PartialEq, Debug)]
7686 -fn serialize_identifier() {
7687 - let id = Identified {
7688 - name: "serde".to_owned(),
7689 - identifier: Identifier::Numeric(100),
7691 - let j = serde_json::to_string(&id).unwrap();
7692 - assert_eq!(j, r#"{"name":"serde","identifier":100}"#);
7694 - let id = Identified {
7695 - name: "serde".to_owned(),
7696 - identifier: Identifier::AlphaNumeric("b100".to_owned()),
7698 - let j = serde_json::to_string(&id).unwrap();
7699 - assert_eq!(j, r#"{"name":"serde","identifier":"b100"}"#);
7703 -fn deserialize_identifier() {
7704 - let j = r#"{"name":"serde","identifier":100}"#;
7705 - let id = serde_json::from_str::<Identified>(j).unwrap();
7706 - let expected = Identified {
7707 - name: "serde".to_owned(),
7708 - identifier: Identifier::Numeric(100),
7710 - assert_eq!(id, expected);
7712 - let j = r#"{"name":"serde","identifier":"b100"}"#;
7713 - let id = serde_json::from_str::<Identified>(j).unwrap();
7714 - let expected = Identified {
7715 - name: "serde".to_owned(),
7716 - identifier: Identifier::AlphaNumeric("b100".to_owned()),
7718 - assert_eq!(id, expected);
7722 -fn serialize_version() {
7723 - let v = Versioned {
7724 - name: "serde".to_owned(),
7725 - vers: Version::parse("1.0.0").unwrap(),
7727 - let j = serde_json::to_string(&v).unwrap();
7728 - assert_eq!(j, r#"{"name":"serde","vers":"1.0.0"}"#);
7732 -fn deserialize_version() {
7733 - let j = r#"{"name":"serde","vers":"1.0.0"}"#;
7734 - let v = serde_json::from_str::<Versioned>(j).unwrap();
7735 - let expected = Versioned {
7736 - name: "serde".to_owned(),
7737 - vers: Version::parse("1.0.0").unwrap(),
7739 - assert_eq!(v, expected);
7743 -fn serialize_versionreq() {
7744 - let v = VersionReq::exact(&Version::parse("1.0.0").unwrap());
7746 - assert_eq!(serde_json::to_string(&v).unwrap(), r#""= 1.0.0""#);
7750 -fn deserialize_versionreq() {
7751 - assert_eq!("1.0.0".parse::<VersionReq>().unwrap(), serde_json::from_str(r#""1.0.0""#).unwrap());
7753 diff --git a/third_party/rust/semver/tests/test_autotrait.rs b/third_party/rust/semver/tests/test_autotrait.rs
7754 new file mode 100644
7756 +++ b/third_party/rust/semver/tests/test_autotrait.rs
7758 +fn assert_send_sync<T: Send + Sync>() {}
7762 + assert_send_sync::<semver::BuildMetadata>();
7763 + assert_send_sync::<semver::Comparator>();
7764 + assert_send_sync::<semver::Error>();
7765 + assert_send_sync::<semver::Prerelease>();
7766 + assert_send_sync::<semver::Version>();
7767 + assert_send_sync::<semver::VersionReq>();
7768 + assert_send_sync::<semver::Op>();
7770 diff --git a/third_party/rust/semver/tests/test_identifier.rs b/third_party/rust/semver/tests/test_identifier.rs
7771 new file mode 100644
7773 +++ b/third_party/rust/semver/tests/test_identifier.rs
7777 + clippy::needless_pass_by_value,
7778 + clippy::toplevel_ref_arg,
7779 + clippy::wildcard_imports
7784 +use crate::util::*;
7785 +use semver::Prerelease;
7789 + fn test(identifier: Prerelease, expected: &str) {
7790 + assert_eq!(identifier.is_empty(), expected.is_empty());
7791 + assert_eq!(identifier.len(), expected.len());
7792 + assert_eq!(identifier.as_str(), expected);
7793 + assert_eq!(identifier, identifier);
7794 + assert_eq!(identifier, identifier.clone());
7797 + let ref mut string = String::new();
7798 + let limit = if cfg!(miri) { 40 } else { 280 }; // miri is slow
7799 + for _ in 0..limit {
7800 + test(prerelease(string), string);
7805 + let ref string = string.repeat(20000);
7806 + test(prerelease(string), string);
7812 + assert_eq!(prerelease("-"), prerelease("-"));
7813 + assert_ne!(prerelease("a"), prerelease("aa"));
7814 + assert_ne!(prerelease("aa"), prerelease("a"));
7815 + assert_ne!(prerelease("aaaaaaaaa"), prerelease("a"));
7816 + assert_ne!(prerelease("a"), prerelease("aaaaaaaaa"));
7817 + assert_ne!(prerelease("aaaaaaaaa"), prerelease("bbbbbbbbb"));
7818 + assert_ne!(build_metadata("1"), build_metadata("001"));
7820 diff --git a/third_party/rust/semver/tests/test_version.rs b/third_party/rust/semver/tests/test_version.rs
7821 new file mode 100644
7823 +++ b/third_party/rust/semver/tests/test_version.rs
7826 + clippy::nonminimal_bool,
7827 + clippy::too_many_lines,
7828 + clippy::wildcard_imports
7833 +use crate::util::*;
7834 +use semver::{BuildMetadata, Prerelease, Version};
7838 + let err = version_err("");
7841 + "unexpected end of input while parsing major version number",
7844 + let err = version_err(" ");
7847 + "unexpected character ' ' while parsing major version number",
7850 + let err = version_err("1");
7853 + "unexpected end of input while parsing major version number",
7856 + let err = version_err("1.2");
7859 + "unexpected end of input while parsing minor version number",
7862 + let err = version_err("1.2.3-");
7863 + assert_to_string(err, "empty identifier segment in pre-release identifier");
7865 + let err = version_err("a.b.c");
7868 + "unexpected character 'a' while parsing major version number",
7871 + let err = version_err("1.2.3 abc");
7872 + assert_to_string(err, "unexpected character ' ' after patch version number");
7874 + let err = version_err("1.2.3-01");
7875 + assert_to_string(err, "invalid leading zero in pre-release identifier");
7877 + let parsed = version("1.2.3");
7878 + let expected = Version::new(1, 2, 3);
7879 + assert_eq!(parsed, expected);
7880 + let expected = Version {
7884 + pre: Prerelease::EMPTY,
7885 + build: BuildMetadata::EMPTY,
7887 + assert_eq!(parsed, expected);
7889 + let parsed = version("1.2.3-alpha1");
7890 + let expected = Version {
7894 + pre: prerelease("alpha1"),
7895 + build: BuildMetadata::EMPTY,
7897 + assert_eq!(parsed, expected);
7899 + let parsed = version("1.2.3+build5");
7900 + let expected = Version {
7904 + pre: Prerelease::EMPTY,
7905 + build: build_metadata("build5"),
7907 + assert_eq!(parsed, expected);
7909 + let parsed = version("1.2.3+5build");
7910 + let expected = Version {
7914 + pre: Prerelease::EMPTY,
7915 + build: build_metadata("5build"),
7917 + assert_eq!(parsed, expected);
7919 + let parsed = version("1.2.3-alpha1+build5");
7920 + let expected = Version {
7924 + pre: prerelease("alpha1"),
7925 + build: build_metadata("build5"),
7927 + assert_eq!(parsed, expected);
7929 + let parsed = version("1.2.3-1.alpha1.9+build5.7.3aedf");
7930 + let expected = Version {
7934 + pre: prerelease("1.alpha1.9"),
7935 + build: build_metadata("build5.7.3aedf"),
7937 + assert_eq!(parsed, expected);
7939 + let parsed = version("1.2.3-0a.alpha1.9+05build.7.3aedf");
7940 + let expected = Version {
7944 + pre: prerelease("0a.alpha1.9"),
7945 + build: build_metadata("05build.7.3aedf"),
7947 + assert_eq!(parsed, expected);
7949 + let parsed = version("0.4.0-beta.1+0851523");
7950 + let expected = Version {
7954 + pre: prerelease("beta.1"),
7955 + build: build_metadata("0851523"),
7957 + assert_eq!(parsed, expected);
7959 + // for https://nodejs.org/dist/index.json, where some older npm versions are "1.1.0-beta-10"
7960 + let parsed = version("1.1.0-beta-10");
7961 + let expected = Version {
7965 + pre: prerelease("beta-10"),
7966 + build: BuildMetadata::EMPTY,
7968 + assert_eq!(parsed, expected);
7973 + assert_eq!(version("1.2.3"), version("1.2.3"));
7974 + assert_eq!(version("1.2.3-alpha1"), version("1.2.3-alpha1"));
7975 + assert_eq!(version("1.2.3+build.42"), version("1.2.3+build.42"));
7976 + assert_eq!(version("1.2.3-alpha1+42"), version("1.2.3-alpha1+42"));
7981 + assert_ne!(version("0.0.0"), version("0.0.1"));
7982 + assert_ne!(version("0.0.0"), version("0.1.0"));
7983 + assert_ne!(version("0.0.0"), version("1.0.0"));
7984 + assert_ne!(version("1.2.3-alpha"), version("1.2.3-beta"));
7985 + assert_ne!(version("1.2.3+23"), version("1.2.3+42"));
7989 +fn test_display() {
7990 + assert_to_string(version("1.2.3"), "1.2.3");
7991 + assert_to_string(version("1.2.3-alpha1"), "1.2.3-alpha1");
7992 + assert_to_string(version("1.2.3+build.42"), "1.2.3+build.42");
7993 + assert_to_string(version("1.2.3-alpha1+42"), "1.2.3-alpha1+42");
7998 + assert!(version("0.0.0") < version("1.2.3-alpha2"));
7999 + assert!(version("1.0.0") < version("1.2.3-alpha2"));
8000 + assert!(version("1.2.0") < version("1.2.3-alpha2"));
8001 + assert!(version("1.2.3-alpha1") < version("1.2.3"));
8002 + assert!(version("1.2.3-alpha1") < version("1.2.3-alpha2"));
8003 + assert!(!(version("1.2.3-alpha2") < version("1.2.3-alpha2")));
8004 + assert!(version("1.2.3+23") < version("1.2.3+42"));
8009 + assert!(version("0.0.0") <= version("1.2.3-alpha2"));
8010 + assert!(version("1.0.0") <= version("1.2.3-alpha2"));
8011 + assert!(version("1.2.0") <= version("1.2.3-alpha2"));
8012 + assert!(version("1.2.3-alpha1") <= version("1.2.3-alpha2"));
8013 + assert!(version("1.2.3-alpha2") <= version("1.2.3-alpha2"));
8014 + assert!(version("1.2.3+23") <= version("1.2.3+42"));
8019 + assert!(version("1.2.3-alpha2") > version("0.0.0"));
8020 + assert!(version("1.2.3-alpha2") > version("1.0.0"));
8021 + assert!(version("1.2.3-alpha2") > version("1.2.0"));
8022 + assert!(version("1.2.3-alpha2") > version("1.2.3-alpha1"));
8023 + assert!(version("1.2.3") > version("1.2.3-alpha2"));
8024 + assert!(!(version("1.2.3-alpha2") > version("1.2.3-alpha2")));
8025 + assert!(!(version("1.2.3+23") > version("1.2.3+42")));
8030 + assert!(version("1.2.3-alpha2") >= version("0.0.0"));
8031 + assert!(version("1.2.3-alpha2") >= version("1.0.0"));
8032 + assert!(version("1.2.3-alpha2") >= version("1.2.0"));
8033 + assert!(version("1.2.3-alpha2") >= version("1.2.3-alpha1"));
8034 + assert!(version("1.2.3-alpha2") >= version("1.2.3-alpha2"));
8035 + assert!(!(version("1.2.3+23") >= version("1.2.3+42")));
8039 +fn test_spec_order() {
8043 + "1.0.0-alpha.beta",
8051 + while i < vs.len() {
8052 + let a = version(vs[i - 1]);
8053 + let b = version(vs[i]);
8054 + assert!(a < b, "nope {:?} < {:?}", a, b);
8061 + let version = version("1.2.3-rc1");
8062 + assert_eq!("1.2.3-rc1 ", format!("{:20}", version));
8063 + assert_eq!("*****1.2.3-rc1******", format!("{:*^20}", version));
8064 + assert_eq!(" 1.2.3-rc1", format!("{:>20}", version));
8066 diff --git a/third_party/rust/semver/tests/test_version_req.rs b/third_party/rust/semver/tests/test_version_req.rs
8067 new file mode 100644
8069 +++ b/third_party/rust/semver/tests/test_version_req.rs
8072 + clippy::missing_panics_doc,
8073 + clippy::shadow_unrelated,
8074 + clippy::toplevel_ref_arg,
8075 + clippy::wildcard_imports
8081 +use crate::util::*;
8082 +use std::collections::hash_map::DefaultHasher;
8083 +use std::hash::{Hash, Hasher};
8085 +#[cfg(test_node_semver)]
8086 +use node::{req, VersionReq};
8087 +#[cfg(not(test_node_semver))]
8088 +use semver::VersionReq;
8090 +#[cfg_attr(not(no_track_caller), track_caller)]
8091 +fn assert_match_all(req: &VersionReq, versions: &[&str]) {
8092 + for string in versions {
8093 + let parsed = version(string);
8094 + assert!(req.matches(&parsed), "did not match {}", string);
8098 +#[cfg_attr(not(no_track_caller), track_caller)]
8099 +fn assert_match_none(req: &VersionReq, versions: &[&str]) {
8100 + for string in versions {
8101 + let parsed = version(string);
8102 + assert!(!req.matches(&parsed), "matched {}", string);
8108 + let ref r = req("1.0.0");
8109 + assert_to_string(r, "^1.0.0");
8110 + assert_match_all(r, &["1.0.0", "1.1.0", "1.0.1"]);
8111 + assert_match_none(r, &["0.9.9", "0.10.0", "0.1.0", "1.0.0-pre", "1.0.1-pre"]);
8115 +#[cfg(not(no_const_vec_new))]
8116 +fn test_default() {
8117 + let ref r = VersionReq::default();
8118 + assert_eq!(r, &VersionReq::STAR);
8123 + let ref r = req("=1.0.0");
8124 + assert_to_string(r, "=1.0.0");
8125 + assert_match_all(r, &["1.0.0"]);
8126 + assert_match_none(r, &["1.0.1", "0.9.9", "0.10.0", "0.1.0", "1.0.0-pre"]);
8128 + let ref r = req("=0.9.0");
8129 + assert_to_string(r, "=0.9.0");
8130 + assert_match_all(r, &["0.9.0"]);
8131 + assert_match_none(r, &["0.9.1", "1.9.0", "0.0.9", "0.9.0-pre"]);
8133 + let ref r = req("=0.0.2");
8134 + assert_to_string(r, "=0.0.2");
8135 + assert_match_all(r, &["0.0.2"]);
8136 + assert_match_none(r, &["0.0.1", "0.0.3", "0.0.2-pre"]);
8138 + let ref r = req("=0.1.0-beta2.a");
8139 + assert_to_string(r, "=0.1.0-beta2.a");
8140 + assert_match_all(r, &["0.1.0-beta2.a"]);
8141 + assert_match_none(r, &["0.9.1", "0.1.0", "0.1.1-beta2.a", "0.1.0-beta2"]);
8143 + let ref r = req("=0.1.0+meta");
8144 + assert_to_string(r, "=0.1.0");
8145 + assert_match_all(r, &["0.1.0", "0.1.0+meta", "0.1.0+any"]);
8149 +pub fn test_greater_than() {
8150 + let ref r = req(">= 1.0.0");
8151 + assert_to_string(r, ">=1.0.0");
8152 + assert_match_all(r, &["1.0.0", "2.0.0"]);
8153 + assert_match_none(r, &["0.1.0", "0.0.1", "1.0.0-pre", "2.0.0-pre"]);
8155 + let ref r = req(">= 2.1.0-alpha2");
8156 + assert_to_string(r, ">=2.1.0-alpha2");
8157 + assert_match_all(r, &["2.1.0-alpha2", "2.1.0-alpha3", "2.1.0", "3.0.0"]);
8158 + assert_match_none(
8160 + &["2.0.0", "2.1.0-alpha1", "2.0.0-alpha2", "3.0.0-alpha2"],
8165 +pub fn test_less_than() {
8166 + let ref r = req("< 1.0.0");
8167 + assert_to_string(r, "<1.0.0");
8168 + assert_match_all(r, &["0.1.0", "0.0.1"]);
8169 + assert_match_none(r, &["1.0.0", "1.0.0-beta", "1.0.1", "0.9.9-alpha"]);
8171 + let ref r = req("<= 2.1.0-alpha2");
8172 + assert_match_all(r, &["2.1.0-alpha2", "2.1.0-alpha1", "2.0.0", "1.0.0"]);
8173 + assert_match_none(
8175 + &["2.1.0", "2.2.0-alpha1", "2.0.0-alpha2", "1.0.0-alpha2"],
8178 + let ref r = req(">1.0.0-alpha, <1.0.0");
8179 + assert_match_all(r, &["1.0.0-beta"]);
8181 + let ref r = req(">1.0.0-alpha, <1.0");
8182 + assert_match_none(r, &["1.0.0-beta"]);
8184 + let ref r = req(">1.0.0-alpha, <1");
8185 + assert_match_none(r, &["1.0.0-beta"]);
8189 +pub fn test_multiple() {
8190 + let ref r = req("> 0.0.9, <= 2.5.3");
8191 + assert_to_string(r, ">0.0.9, <=2.5.3");
8192 + assert_match_all(r, &["0.0.10", "1.0.0", "2.5.3"]);
8193 + assert_match_none(r, &["0.0.8", "2.5.4"]);
8195 + let ref r = req("0.3.0, 0.4.0");
8196 + assert_to_string(r, "^0.3.0, ^0.4.0");
8197 + assert_match_none(r, &["0.0.8", "0.3.0", "0.4.0"]);
8199 + let ref r = req("<= 0.2.0, >= 0.5.0");
8200 + assert_to_string(r, "<=0.2.0, >=0.5.0");
8201 + assert_match_none(r, &["0.0.8", "0.3.0", "0.5.1"]);
8203 + let ref r = req("0.1.0, 0.1.4, 0.1.6");
8204 + assert_to_string(r, "^0.1.0, ^0.1.4, ^0.1.6");
8205 + assert_match_all(r, &["0.1.6", "0.1.9"]);
8206 + assert_match_none(r, &["0.1.0", "0.1.4", "0.2.0"]);
8208 + let err = req_err("> 0.1.0,");
8211 + "unexpected end of input while parsing major version number",
8214 + let err = req_err("> 0.3.0, ,");
8217 + "unexpected character ',' while parsing major version number",
8220 + let ref r = req(">=0.5.1-alpha3, <0.6");
8221 + assert_to_string(r, ">=0.5.1-alpha3, <0.6");
8232 + assert_match_none(
8234 + &["0.5.1-alpha1", "0.5.2-alpha3", "0.5.5-pre", "0.5.0-pre"],
8236 + assert_match_none(r, &["0.6.0", "0.6.0-pre"]);
8238 + // https://github.com/steveklabnik/semver/issues/56
8239 + let err = req_err("1.2.3 - 2.3.4");
8240 + assert_to_string(err, "expected comma after patch version number, found '-'");
8244 +pub fn test_whitespace_delimited_comparator_sets() {
8245 + // https://github.com/steveklabnik/semver/issues/55
8246 + let err = req_err("> 0.0.9 <= 2.5.3");
8247 + assert_to_string(err, "expected comma after patch version number, found '<'");
8251 +pub fn test_tilde() {
8252 + let ref r = req("~1");
8253 + assert_match_all(r, &["1.0.0", "1.0.1", "1.1.1"]);
8254 + assert_match_none(r, &["0.9.1", "2.9.0", "0.0.9"]);
8256 + let ref r = req("~1.2");
8257 + assert_match_all(r, &["1.2.0", "1.2.1"]);
8258 + assert_match_none(r, &["1.1.1", "1.3.0", "0.0.9"]);
8260 + let ref r = req("~1.2.2");
8261 + assert_match_all(r, &["1.2.2", "1.2.4"]);
8262 + assert_match_none(r, &["1.2.1", "1.9.0", "1.0.9", "2.0.1", "0.1.3"]);
8264 + let ref r = req("~1.2.3-beta.2");
8265 + assert_match_all(r, &["1.2.3", "1.2.4", "1.2.3-beta.2", "1.2.3-beta.4"]);
8266 + assert_match_none(r, &["1.3.3", "1.1.4", "1.2.3-beta.1", "1.2.4-beta.2"]);
8270 +pub fn test_caret() {
8271 + let ref r = req("^1");
8272 + assert_match_all(r, &["1.1.2", "1.1.0", "1.2.1", "1.0.1"]);
8273 + assert_match_none(r, &["0.9.1", "2.9.0", "0.1.4"]);
8274 + assert_match_none(r, &["1.0.0-beta1", "0.1.0-alpha", "1.0.1-pre"]);
8276 + let ref r = req("^1.1");
8277 + assert_match_all(r, &["1.1.2", "1.1.0", "1.2.1"]);
8278 + assert_match_none(r, &["0.9.1", "2.9.0", "1.0.1", "0.1.4"]);
8280 + let ref r = req("^1.1.2");
8281 + assert_match_all(r, &["1.1.2", "1.1.4", "1.2.1"]);
8282 + assert_match_none(r, &["0.9.1", "2.9.0", "1.1.1", "0.0.1"]);
8283 + assert_match_none(r, &["1.1.2-alpha1", "1.1.3-alpha1", "2.9.0-alpha1"]);
8285 + let ref r = req("^0.1.2");
8286 + assert_match_all(r, &["0.1.2", "0.1.4"]);
8287 + assert_match_none(r, &["0.9.1", "2.9.0", "1.1.1", "0.0.1"]);
8288 + assert_match_none(r, &["0.1.2-beta", "0.1.3-alpha", "0.2.0-pre"]);
8290 + let ref r = req("^0.5.1-alpha3");
8301 + assert_match_none(
8312 + let ref r = req("^0.0.2");
8313 + assert_match_all(r, &["0.0.2"]);
8314 + assert_match_none(r, &["0.9.1", "2.9.0", "1.1.1", "0.0.1", "0.1.4"]);
8316 + let ref r = req("^0.0");
8317 + assert_match_all(r, &["0.0.2", "0.0.0"]);
8318 + assert_match_none(r, &["0.9.1", "2.9.0", "1.1.1", "0.1.4"]);
8320 + let ref r = req("^0");
8321 + assert_match_all(r, &["0.9.1", "0.0.2", "0.0.0"]);
8322 + assert_match_none(r, &["2.9.0", "1.1.1"]);
8324 + let ref r = req("^1.4.2-beta.5");
8327 + &["1.4.2", "1.4.3", "1.4.2-beta.5", "1.4.2-beta.6", "1.4.2-c"],
8329 + assert_match_none(
8342 +pub fn test_wildcard() {
8343 + let err = req_err("");
8346 + "unexpected end of input while parsing major version number",
8349 + let ref r = req("*");
8350 + assert_match_all(r, &["0.9.1", "2.9.0", "0.0.9", "1.0.1", "1.1.1"]);
8351 + assert_match_none(r, &["1.0.0-pre"]);
8353 + for s in &["x", "X"] {
8354 + assert_eq!(*r, req(s));
8357 + let ref r = req("1.*");
8358 + assert_match_all(r, &["1.2.0", "1.2.1", "1.1.1", "1.3.0"]);
8359 + assert_match_none(r, &["0.0.9", "1.2.0-pre"]);
8361 + for s in &["1.x", "1.X", "1.*.*"] {
8362 + assert_eq!(*r, req(s));
8365 + let ref r = req("1.2.*");
8366 + assert_match_all(r, &["1.2.0", "1.2.2", "1.2.4"]);
8367 + assert_match_none(r, &["1.9.0", "1.0.9", "2.0.1", "0.1.3", "1.2.2-pre"]);
8369 + for s in &["1.2.x", "1.2.X"] {
8370 + assert_eq!(*r, req(s));
8375 +pub fn test_logical_or() {
8376 + // https://github.com/steveklabnik/semver/issues/57
8377 + let err = req_err("=1.2.3 || =2.3.4");
8378 + assert_to_string(err, "expected comma after patch version number, found '|'");
8380 + let err = req_err("1.1 || =1.2.3");
8381 + assert_to_string(err, "expected comma after minor version number, found '|'");
8383 + let err = req_err("6.* || 8.* || >= 10.*");
8384 + assert_to_string(err, "expected comma after minor version number, found '|'");
8388 +pub fn test_any() {
8389 + #[cfg(not(no_const_vec_new))]
8390 + let ref r = VersionReq::STAR;
8391 + #[cfg(no_const_vec_new)]
8392 + let ref r = VersionReq {
8393 + comparators: Vec::new(),
8395 + assert_match_all(r, &["0.0.1", "0.1.0", "1.0.0"]);
8399 +pub fn test_pre() {
8400 + let ref r = req("=2.1.1-really.0");
8401 + assert_match_all(r, &["2.1.1-really.0"]);
8405 +pub fn test_parse_errors() {
8406 + let err = req_err("\0");
8409 + "unexpected character '\\0' while parsing major version number",
8412 + let err = req_err(">= >= 0.0.2");
8415 + "unexpected character '>' while parsing major version number",
8418 + let err = req_err(">== 0.0.2");
8421 + "unexpected character '=' while parsing major version number",
8424 + let err = req_err("a.0.0");
8427 + "unexpected character 'a' while parsing major version number",
8430 + let err = req_err("1.0.0-");
8431 + assert_to_string(err, "empty identifier segment in pre-release identifier");
8433 + let err = req_err(">=");
8436 + "unexpected end of input while parsing major version number",
8441 +fn test_cargo3202() {
8442 + let ref r = req("0.*.*");
8443 + assert_to_string(r, "0.*");
8444 + assert_match_all(r, &["0.5.0"]);
8446 + let ref r = req("0.0.*");
8447 + assert_to_string(r, "0.0.*");
8451 +fn test_digit_after_wildcard() {
8452 + let err = req_err("*.1");
8453 + assert_to_string(err, "unexpected character after wildcard in version req");
8455 + let err = req_err("1.*.1");
8456 + assert_to_string(err, "unexpected character after wildcard in version req");
8458 + let err = req_err(">=1.*.1");
8459 + assert_to_string(err, "unexpected character after wildcard in version req");
8463 +fn test_eq_hash() {
8464 + fn calculate_hash(value: impl Hash) -> u64 {
8465 + let mut hasher = DefaultHasher::new();
8466 + value.hash(&mut hasher);
8470 + assert!(req("^1") == req("^1"));
8471 + assert!(calculate_hash(req("^1")) == calculate_hash(req("^1")));
8472 + assert!(req("^1") != req("^2"));
8476 +fn test_leading_digit_in_pre_and_build() {
8477 + for op in &["=", ">", ">=", "<", "<=", "~", "^"] {
8478 + // digit then alpha
8479 + req(&format!("{} 1.2.3-1a", op));
8480 + req(&format!("{} 1.2.3+1a", op));
8482 + // digit then alpha (leading zero)
8483 + req(&format!("{} 1.2.3-01a", op));
8484 + req(&format!("{} 1.2.3+01", op));
8487 + req(&format!("{} 1.2.3-1+1", op));
8488 + req(&format!("{} 1.2.3-1-1+1-1-1", op));
8489 + req(&format!("{} 1.2.3-1a+1a", op));
8490 + req(&format!("{} 1.2.3-1a-1a+1a-1a-1a", op));
8495 +fn test_wildcard_and_another() {
8496 + let err = req_err("*, 0.20.0-any");
8499 + "wildcard req (*) must be the only comparator in the version req",
8502 + let err = req_err("0.20.0-any, *");
8505 + "wildcard req (*) must be the only comparator in the version req",
8508 + let err = req_err("0.20.0-any, *, 1.0");
8511 + "wildcard req (*) must be the only comparator in the version req",
8514 diff --git a/third_party/rust/semver/tests/util/mod.rs b/third_party/rust/semver/tests/util/mod.rs
8515 new file mode 100644
8517 +++ b/third_party/rust/semver/tests/util/mod.rs
8519 +#![allow(dead_code)]
8521 +use semver::{BuildMetadata, Error, Prerelease, Version, VersionReq};
8522 +use std::fmt::Display;
8524 +#[cfg_attr(not(no_track_caller), track_caller)]
8525 +pub(super) fn version(text: &str) -> Version {
8526 + Version::parse(text).unwrap()
8529 +#[cfg_attr(not(no_track_caller), track_caller)]
8530 +pub(super) fn version_err(text: &str) -> Error {
8531 + Version::parse(text).unwrap_err()
8534 +#[cfg_attr(not(no_track_caller), track_caller)]
8535 +pub(super) fn req(text: &str) -> VersionReq {
8536 + VersionReq::parse(text).unwrap()
8539 +#[cfg_attr(not(no_track_caller), track_caller)]
8540 +pub(super) fn req_err(text: &str) -> Error {
8541 + VersionReq::parse(text).unwrap_err()
8544 +#[cfg_attr(not(no_track_caller), track_caller)]
8545 +pub(super) fn prerelease(text: &str) -> Prerelease {
8546 + Prerelease::new(text).unwrap()
8549 +#[cfg_attr(not(no_track_caller), track_caller)]
8550 +pub(super) fn build_metadata(text: &str) -> BuildMetadata {
8551 + BuildMetadata::new(text).unwrap()
8554 +#[cfg_attr(not(no_track_caller), track_caller)]
8555 +pub(super) fn assert_to_string(value: impl Display, expected: &str) {
8556 + assert_eq!(value.to_string(), expected);
8558 diff --git a/toolkit/library/rust/shared/Cargo.toml b/toolkit/library/rust/shared/Cargo.toml
8559 --- a/toolkit/library/rust/shared/Cargo.toml
8560 +++ b/toolkit/library/rust/shared/Cargo.toml
8561 @@ -16,17 +16,17 @@ nsstring = { path = "../../../../xpcom/r
8562 netwerk_helper = { path = "../../../../netwerk/base/rust-helper" }
8563 xpcom = { path = "../../../../xpcom/rust/xpcom" }
8564 prefs_parser = { path = "../../../../modules/libpref/parser" }
8565 static_prefs = { path = "../../../../modules/libpref/init/static_prefs" }
8566 profiler_helper = { path = "../../../../tools/profiler/rust-helper", optional = true }
8567 mozurl = { path = "../../../../netwerk/base/mozurl" }
8568 webrender_bindings = { path = "../../../../gfx/webrender_bindings" }
8569 cubeb-coreaudio = { git = "https://github.com/mozilla/cubeb-coreaudio-rs", rev = "44eca95823bb57e964cf7b6d9791ed2ccb4b2108", optional = true }
8570 -cubeb-pulse = { git = "https://github.com/mozilla/cubeb-pulse-rs", rev="df4dc0288b07b865440f4c7e41ca49ca9ccffc63", optional = true, features=["pulse-dlopen"] }
8571 +cubeb-pulse = { git = "https://github.com/mozilla/cubeb-pulse-rs", rev="1f1fe1e08e01a9a534ec7f079702a583a0899ce7", optional = true, features=["pulse-dlopen"] }
8572 cubeb-sys = { version = "0.10", optional = true, features=["gecko-in-tree"] }
8573 audioipc2-client = { git = "https://github.com/kinetiknz/audioipc-2", rev = "85e9839059f4bf8f68130825b8fd02c39a6a51b9", optional = true } # macos (v2) branch
8574 audioipc2-server = { git = "https://github.com/kinetiknz/audioipc-2", rev = "85e9839059f4bf8f68130825b8fd02c39a6a51b9", optional = true } # macos (v2) branch
8575 audioipc-client = { git = "https://github.com/mozilla/audioipc-2", rev = "c144368c4e084ec0f076af6262970655c2d99e8d", optional = true }
8576 audioipc-server = { git = "https://github.com/mozilla/audioipc-2", rev = "c144368c4e084ec0f076af6262970655c2d99e8d", optional = true }
8577 encoding_glue = { path = "../../../../intl/encoding_glue" }
8578 authenticator = "0.3.1"
8579 gkrust_utils = { path = "../../../../xpcom/rust/gkrust_utils" }
8580 diff --git a/xpcom/rust/gkrust_utils/Cargo.toml b/xpcom/rust/gkrust_utils/Cargo.toml
8581 --- a/xpcom/rust/gkrust_utils/Cargo.toml
8582 +++ b/xpcom/rust/gkrust_utils/Cargo.toml
8585 name = "gkrust_utils"
8587 authors = ["Jonathan Kingston <jkt@mozilla.com>"]
8592 nsstring = { path = "../nsstring" }
8594 diff --git a/third_party/rust/packed_simd_2/Cargo.toml b/third_party/rust/packed_simd_2/Cargo.toml
8595 --- a/third_party/rust/packed_simd_2/Cargo.toml
8596 +++ b/third_party/rust/packed_simd_2/Cargo.toml
8597 @@ -24,7 +24,7 @@ codecov = { repository = "rust-lang/pack
8598 core_arch = { version = "0.1.5", optional = true }
8600 [build-dependencies]
8601 -rustc_version = "0.2"
8602 +rustc_version = "0.4"
8606 diff --git a/third_party/rust/packed_simd_2/.cargo-checksum.json b/third_party/rust/packed_simd_2/.cargo-checksum.json
8607 --- a/third_party/rust/packed_simd_2/.cargo-checksum.json
8608 +++ b/third_party/rust/packed_simd_2/.cargo-checksum.json
8610 -{"files":{".appveyor.yml":"f1ed01850e0d725f9498f52a1a63ddf40702ad6e0bf5b2d7c4c04d76e96794a3",".travis.yml":"30a61a5ec53355fc1f3585e1690280308c2b7961701abc11e8389b235b647178","Cargo.toml":"e76b42f3247fccb7174046c499bfaae5430d83cadeb8140259fcae34613483cf","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"fa4dd64f66972217d35b7653338c9e2011ccd8f3008ae7c0103272d4287f9b1d","bors.toml":"dee881dc69b9b7834e4eba5d95c3ed5a416d4628815a167d6a22d4cb4fb064b8","build.rs":"a766fba121243a9b617432c592873801adb74c3a2f4a24d9d45859b8ce9357fc","ci/all.sh":"2ae6b2445b4db83833e40b37efd0016c6b9879ee988b9b3ef94db5439a3e1606","ci/android-install-ndk.sh":"0f1746108cc30bf9b9ba45bcde7b19fc1a8bdf5b0258035b4eb8dc69b75efac4","ci/android-install-sdk.sh":"3490432022c5c8f5a115c084f7a9aca1626f96c0c87ffb62019228c4346b47e4","ci/android-sysimage.sh":"ebf4e5daa1f0fe1b2092b79f0f3f161c4c4275cb744e52352c4d81ab451e4c5a","ci/benchmark.sh":"b61d19ef6b90deba8fb79dee74c8b062d94844676293da346da87bb78a9a49a4","ci/deploy_and_run_on_ios_simulator.rs":"ec8ecf82d92072676aa47f0d1a3d021b60a7ae3531153ef12d2ff4541fc294dc","ci/docker/aarch64-linux-android/Dockerfile":"ace2e7d33c87bc0f6d3962a4a3408c04557646f7f51ab99cfbf574906796b016","ci/docker/aarch64-unknown-linux-gnu/Dockerfile":"da88c0d50f16dc08448c7fdf1fa5ed2cbe576acf9e7dd85b5b818621b2a8c702","ci/docker/arm-linux-androideabi/Dockerfile":"370e55d3330a413a3ccf677b3afb3e0ef9018a5fab263faa97ae8ac017fc2286","ci/docker/arm-unknown-linux-gnueabi/Dockerfile":"bb5f8ae890707c128652290ffc544447643bf12037ddd73c6ad6989f848cb380","ci/docker/arm-unknown-linux-gnueabihf/Dockerfile":"1afaefcbc05b740859acd4e067bc92439be6bcbe8f2e9678474fb434bcd398d9","ci/docker/armv7-unknown-linux-gnueabihf/Dockerfile":"8282ea707a94109beed47a57574755e2d58401735904a03f85fb64c578c53b4f","ci/docker/i586-unknown-linux-gnu/Dockerfile":"49792922269f371bd29da4727e9085101b27be67a6b97755d0196c63317f7abb","ci/docker/i686-unknown-linux-gnu/Dockerfile":"49792922269f371bd29da4727e9085101b27be67a6b97755d0196c63317f7abb","ci/docker/mips-unknown-linux-gnu/Dockerfile":"b2ebc25797612c4f8395fe9d407725156044955bfbcf442036b7f55b43a5f9da","ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile":"b0c1692ac65bc56dd30494b1993d8e929c48cc9c4b92029b7c7592af6d4f9220","ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile":"4e9249c179300138141d0b2b7401b11897f64aed69f541f078c1db4594df2827","ci/docker/mipsel-unknown-linux-musl/Dockerfile":"3164c52b0dcbb01afa78292b15b5c43503ccf0491cf6eb801ec2bf22ae274e52","ci/docker/powerpc-unknown-linux-gnu/Dockerfile":"786f799d0b56eb54d7b6c4b00e1aed4ce81776e14e44767e083c89d014b72004","ci/docker/powerpc64-unknown-linux-gnu/Dockerfile":"e8bc363837cd9c2d8b22402acb8c1c329efc11ba5d12170603d2fe2eae9da059","ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile":"47998d45b781d797b9e6085ebe898d90de0c952b54537a8db4e8d7503eb032d9","ci/docker/s390x-unknown-linux-gnu/Dockerfile":"93fb44df3d7fd31ead158570667c97b5076a05c3d968af4a84bc13819a8f2db8","ci/docker/sparc64-unknown-linux-gnu/Dockerfile":"da1c39a3ff1fe22e41395fa7c8934e90b4c1788e551b9aec6e38bfd94effc437","ci/docker/thumbv7neon-linux-androideabi/Dockerfile":"c2decd5591bd7a09378901bef629cd944acf052eb55e4f35b79eb9cb4d62246a","ci/docker/thumbv7neon-unknown-linux-gnueabihf/Dockerfile":"51955a8bf3c4d440f47382af6f5426ebff94ab01a04da36175babda9a057740f","ci/docker/wasm32-unknown-unknown/Dockerfile":"5a022299f56730cf8c432a07391e95e199cfa36dc8da2a96c9d185c8de93e913","ci/docker/x86_64-linux-android/Dockerfile":"685040273cf350d5509e580ac451555efa19790c8723ca2af066adadc6880ad2","ci/docker/x86_64-unknown-linux-gnu-emulated/Dockerfile":"44b6203d9290bfdc53d81219f0937e1110847a23dd982ec8c4de388354f01536","ci/docker/x86_64-unknown-linux-gnu/Dockerfile":"7f4e3ca5fa288ea70edb4d1f75309708cd30b192e2e4444e61c4d5b3b58f89cf","ci/dox.sh":"434e9611c52e389312d2b03564adf09429f10cc76fe66a8644adb104903b87b7","ci/linux-s390x.sh":"d6b732d7795b4ba131326aff893bca6228a7d2eb0e9402f135705413dbbe0dce","ci/linux-sparc64.sh":"c92966838b1ab7ad3b7a344833ee726aba6b647cf5952e56f0ad1ba420b13325","ci/lld-shim.rs":"3d7f71ec23a49e2b67f694a0168786f9a954dda15f5a138815d966643fd3fcc3","ci/max_line_width.sh":"0a1518bba4c9ecaa55694cb2e9930d0e19c265baabf73143f17f9cf285aaa5bb","ci/run-docker.sh":"92e036390ad9b0d16f109579df1b5ced2e72e9afea40c7d011400ebd3a2a90de","ci/run.sh":"41dd6a60efaaeae9661a01370cce98b631f78392859a0cf68c946c0a16edf5f7","ci/run_examples.sh":"d1a23c6c35374a0678ba5114b9b8fefd8be0a79e774872a8bf0898d1baca18d0","ci/runtest-android.rs":"145a8e9799a5223975061fe7e586ade5669ee4877a7d7a4cf6b4ab48e8e36c7c","ci/setup_benchmarks.sh":"fae3960023f6f3d1388cd2ad22fdbab4b075f1f29dd4292d7994a20783beb6cf","ci/test-runner-linux":"c8aa6025cff5306f4f31d0c61dc5f9d4dd5a1d189ab613ef8d4c367c694d9ccd","contributing.md":"2d2629310ad4d464c482bdbb5819f0d6ce223c576aeef2cdce6a1f6857085ea5","perf-guide/.gitignore":"fe82c7da551079d832cf74200b0b359b4df9828cb4a0416fa7384f07a2ae6a13","perf-guide/book.toml":"115a98284126c6b180178b44713314cc494f08a71662ee2ce15cf67f17a51064","perf-guide/src/SUMMARY.md":"3e03bffc991fdc2050f3d51842d72d9d21ea6abab56a3baf3b2d5973a78b89e1","perf-guide/src/ascii.css":"29afb08833b2fe2250f0412e1fa1161a2432a0820a14953c87124407417c741a","perf-guide/src/bound_checks.md":"5e4991ff58a183ef0cd9fdc1feb4cd12d083b44bdf87393bbb0927808ef3ce7d","perf-guide/src/float-math/approx.md":"8c09032fa2d795a0c5db1775826c850d28eb2627846d0965c60ee72de63735ad","perf-guide/src/float-math/fma.md":"311076ba4b741d604a82e74b83a8d7e8c318fcbd7f64c4392d1cf5af95c60243","perf-guide/src/float-math/fp.md":"04153e775ab6e4f0d7837bcc515230d327b04edfa34c84ce9c9e10ebaeef2be8","perf-guide/src/float-math/svml.md":"0798873b8eedaeda5fed62dc91645b57c20775a02d3cd74d8bd06958f1516506","perf-guide/src/introduction.md":"9f5a19e9e6751f25d2daad39891a0cc600974527ec4c8305843f9618910671bd","perf-guide/src/prof/linux.md":"447731eb5de7d69166728fdbc5ecb0c0c9db678ea493b45a592d67dd002184c0","perf-guide/src/prof/mca.md":"f56d54f3d20e7aa4d32052186e8237b03d65971eb5d112802b442570ff11d344","perf-guide/src/prof/profiling.md":"8a650c0fd6ede0964789bb6577557eeef1d8226a896788602ce61528e260e43c","perf-guide/src/target-feature/attribute.md":"615f88dca0a707b6c416fa605435dd6e1fb5361cc639429cbf68cd87624bd78b","perf-guide/src/target-feature/features.md":"17077760ff24c006b606dd21889c53d87228f4311f3ba3a574f9afdeacd86165","perf-guide/src/target-feature/inlining.md":"7ed1d7068d8173a00d84c16cfe5871cd68b9f04f8d0cca2d01ebc84957ebf2f6","perf-guide/src/target-feature/practice.md":"c4b371842e0086df178488fec97f20def8f0c62ee588bcd25fd948b9b1fa227e","perf-guide/src/target-feature/runtime.md":"835425f5ee597fb3e51d36e725a81ebee29f4561231d19563cd4da81dbb1cfcb","perf-guide/src/target-feature/rustflags.md":"01197acf6f0adec8db32b8591811f69cecb6555a2b05dc5d5ec27d0e3f7b065e","perf-guide/src/vert-hor-ops.md":"c6211c0ee91e60552ec592d89d9d957eedc21dee3cbd89e1ad6765ea06a27471","rustfmt.toml":"d99a43f3f8ef9e425cf01c333fba9f0051f888f5d87ab4e8f63c2f7d0fe6620f","src/api.rs":"bb1795e9657a8298d37d2349b45443f08e9e455399ad4b727018600728478c10","src/api/bit_manip.rs":"c47a4d0f7451f7e35d07715e4f39a472e07457fd456fdb726864a4f6887252a3","src/api/bitmask.rs":"6d2beefd62ee5d9c8eb060bee6abc641616bf828c99f82abf97b21bf004e894b","src/api/cast.rs":"03b94a3d316ac7b7be7068810044911e965e889a0ace7bae762749ca74a92747","src/api/cast/macros.rs":"b0a14d0c83ad2ebb7a275180f6d9e3f2bc312ba57a7d3d6c39fad4e0f20f9408","src/api/cast/v128.rs":"edd0994efac4379dff26e178423a52dbb3ffeb38b1fc97cae975d744c00b4fb6","src/api/cast/v16.rs":"96bd98c2d21b0663abe6c0ab33005b1fa693f3db7ee6795351391343863484da","src/api/cast/v256.rs":"8c31fe91f5e78ef737dfba6979cc1240210cb094a89d284fe459bf8a991ca24b","src/api/cast/v32.rs":"a99a79dd84d2a5e6adf9db98705675915bd03fd1287d489c7fe38e84d7e4a086","src/api/cast/v512.rs":"c0dd526f41ed7b8a71c3743d91267554ec0a0c75834ccc2e3ecb0ef3004af642","src/api/cast/v64.rs":"6572fdba2a1241a6cd666d3f0cce3306cd2cb7e5e236172e59d5d4351c8a88af","src/api/cmp.rs":"357c3a2a09c6d4611c32dd7fa95be2fae933d513e229026ec9b44451a77b884e","src/api/cmp/eq.rs":"60f70f355bae4cb5b17db53204cacc3890f70670611c17df638d4c04f7cc8075","src/api/cmp/ord.rs":"589f7234761c294fa5df8f525bc4acd5a47cdb602207d524a0d4e19804cd9695","src/api/cmp/partial_eq.rs":"902ccb8aa01fd5738b30ba0b712669c21d4801958907e03bad23432c7dba0198","src/api/cmp/partial_ord.rs":"9db0c37d7434cdfc62d8d66912e972fa3d8c115ab2af051a6f45e414bd3e4f1c","src/api/cmp/vertical.rs":"de3d62f38eba817299aa16f1e1939954c9a447e316509397465c2830852ba053","src/api/default.rs":"67bf21c134127d12a7028c8b88a57f0ceee8ccbd74976da8ca74eb9f16a174d5","src/api/fmt.rs":"67fb804bb86b6cd77cf8cd492b5733ce437071b66fe3297278b8a6552c325dda","src/api/fmt/binary.rs":"02b2b287f7404f8a983813cf70c87108c8da3835578b63ab303116885f609413","src/api/fmt/debug.rs":"56e1c3bdc092747344fffaafff9da7163ee7827857f6fb7cb1c9923eca4f6fa0","src/api/fmt/lower_hex.rs":"558fd592f7f485712fb051509cecc7174a21e6bf62e5ce64766e75afc97bb8e1","src/api/fmt/octal.rs":"3b2e70877a4f368c7704f8e254236c014c365c74d93371c1feb5f030e6c66422","src/api/fmt/upper_hex.rs":"2a442f666bc80e22d41f903f881238fe114dd49344c3ed69849250e853cafc5d","src/api/from.rs":"2e599d8329cb05eaf06224cc441355c4b7b51254fc19256619333be8c149d444","src/api/from/from_array.rs":"dd3fc64fb17d6184bb60343f8da26a05edf0e5f3c14caf55d49fa15e21d948dc","src/api/from/from_vector.rs":"9764371aa9e6005aace74dea14f59e5611a095b7cf42707940924749282c52f0","src/api/hash.rs":"5076ece87969592c876486f5b1ea8affbeaec379d1a14a30859e0aa5592019de","src/api/into_bits.rs":"1ee15923352786b9ab4a31fa506762297116b18cfdb8e72853abc8ad001651d2","src/api/into_bits/arch_specific.rs":"e7445021f3908326bfee758835e5fc5ad56aa1baa77fc1c58abe4350c66c670a","src/api/into_bits/macros.rs":"bb4fe99be2af6a21d805efab44c8e4e61a7b2adb42a65504a0cf26d13efdadcd","src/api/into_bits/v128.rs":"145a44922b09a5ca5b62d88a461d327d399a997a15db4b11d7b17e554a9fa4c0","src/api/into_bits/v16.rs":"f4f4f61ba88aa51b158ec56ca3dce234349aea0daf2b3029a14ab5125d1e41e5","src/api/into_bits/v256.rs":"8cea9c5d9809f11323cb7cdc53b83df593fd17caf926251e412ae9777bed547f","src/api/into_bits/v32.rs":"905ba683d342fa32f4202b80bb46530807bd0a5b588f6c2e8c9f475223c47775","src/api/into_bits/v512.rs":"e25afa1fbf088a5d58e7d75d197b6cd4c56637ea28542ba18e46a451f29d04e7","src/api/into_bits/v64.rs":"d6238022ccff7b92e55b3f6017fc269acb6f36330a6d7e8fb389853a0f1b6478","src/api/math.rs":"8b2a2fc651917a850539f993aa0b9e5bf4da67b11685285b8de8cdca311719ec","src/api/math/float.rs":"61d2794d68262a1090ae473bd30793b5f65cf732f32a6694a3af2ce5d9225616","src/api/math/float/abs.rs":"5b6b2701e2e11135b7ce58a05052ea8120e10e4702c95d046b9d21b827b26bf8","src/api/math/float/consts.rs":"6302c9261da4291d144d5bb53493cdd073498feb40955fb6860ea3c4d06c978a","src/api/math/float/cos.rs":"4c2dd7173728ef189314f1576c9486e03be21b7da98843b2f9011282a7979e31","src/api/math/float/exp.rs":"7c6d5f1e304f498a01cfa23b92380c815d7da0ad94eae3483783bc377d287eef","src/api/math/float/ln.rs":"54c7583f3df793b39ff57534fade27b41bb992439e5dc178252f5ca3190a3e54","src/api/math/float/mul_add.rs":"62cac77660d20159276d4c9ef066eb90c81cbddb808e8e157182c607625ad2eb","src/api/math/float/mul_adde.rs":"bae056ee9f3a70df39ec3c3b2f6437c65303888a7b843ef1a5bcf1f5aca0e602","src/api/math/float/powf.rs":"9ddb938984b36d39d82a82f862f80df8f7fb013f1d222d45698d41d88472f568","src/api/math/float/recpre.rs":"589225794ff1dbf31158dff660e6d4509ecc8befbb57c633900dea5ac0b840d6","src/api/math/float/rsqrte.rs":"a32abdcc318d7ccc8448231f54d75b884b7cbeb03a7d595713ab6243036f4dbf","src/api/math/float/sin.rs":"cbd3622b7df74f19691743001c8cf747a201f8977ad90542fee915f37dcd1e49","src/api/math/float/sqrt.rs":"0c66d5d63fb08e4d99c6b82a8828e41173aff1ac9fa1a2764a11fac217ccf2ac","src/api/math/float/sqrte.rs":"731e1c9f321b662accdd27dacb3aac2e8043b7aecb2f2161dde733bd9f025362","src/api/minimal.rs":"1f22bcc528555444e76de569ec0ae2029b9ae9d04805efeafa93369c8098036b","src/api/minimal/iuf.rs":"819cff26d3e196f807645bcc1d79eb27d9f175edb89910f2274d52a1e913cd11","src/api/minimal/mask.rs":"0cae10ae1fc65f5070e686c0c79bfba27b86b33d6c399367bd4848fb367dcec4","src/api/minimal/ptr.rs":"f65ebf21866a863485344432d9a7a9b7418f7fad5fdf841a4e2fa56ec0766ad0","src/api/ops.rs":"3e273b277a0f3019d42c3c59ca94a5afd4885d5ae6d2182e5089bbeec9de42ee","src/api/ops/scalar_arithmetic.rs":"d2d5ad897a59dd0787544f927e0e7ca4072c3e58b0f4a2324083312b0d5a21d7","src/api/ops/scalar_bitwise.rs":"482204e459ca6be79568e1c9f70adbe2d2151412ddf122fb2161be8ebb51c40c","src/api/ops/scalar_mask_bitwise.rs":"c250f52042e37b22d57256c80d4604104cfd2fbe2a2e127c676267270ca5d350","src/api/ops/scalar_shifts.rs":"c4773d435c3f9da4454327e6fbb2b5b41a1c0ebb1cca7372e69dc7a344a1b6e4","src/api/ops/vector_arithmetic.rs":"ddca15d09ddeef502c2ed66117a62300ca65d87e959e8b622d767bdf1c307910","src/api/ops/vector_bitwise.rs":"b3968f7005b649edcc22a54e2379b14d5ee19045f2e784029805781ae043b5ee","src/api/ops/vector_float_min_max.rs":"76bf8cb607e2c442923c1da1061a6b80d742d607408033c2a3761161114cf2a0","src/api/ops/vector_int_min_max.rs":"a378789c6ff9b32a51fbd0a97ffd36ed102cd1fe6a067d2b02017c1df342def6","src/api/ops/vector_mask_bitwise.rs":"5052d18517d765415d40327e6e8e55a312daaca0a5e2aec959bfa54b1675f9c8","src/api/ops/vector_neg.rs":"5c62f6b0221983cdbd23cd0a3af3672e6ba1255f0dfe8b19aae6fbd6503e231b","src/api/ops/vector_rotates.rs":"ee319eaaa449dc50ea8ef05b89d38519c6faa6753dfdce432ea7bb8520e4e8e7","src/api/ops/vector_shifts.rs":"e510be14127c0ffd58a2573a39701da3557d66bedec09837ac8bbd44d579da00","src/api/ptr.rs":"8a793251bed6130dcfb2f1519ceaa18b751bbb15875928d0fb6deb5a5e07523a","src/api/ptr/gather_scatter.rs":"3d614f9d5b4ca201a9f7e46af4405e1d2c28ecee1620297c23b52e37b92cc0ea","src/api/reductions.rs":"ae5baca81352ecd44526d6c30c0a1feeda475ec73ddd3c3ec6b14e944e5448ee","src/api/reductions/bitwise.rs":"8bf910ae226188bd15fc7e125f058cd2566b6186fcd0cd8fd020f352c39ce139","src/api/reductions/float_arithmetic.rs":"47a5679896db2cbb56c31372fe42143da015b6beae7db5d2f3a0309ddf427ae1","src/api/reductions/integer_arithmetic.rs":"c2df3cf7493cca4174f2c65aea422a3d20d8a23af03f8d57cef72c19fee8f20d","src/api/reductions/mask.rs":"db83327a950e33a317f37fd33ca4e20c347fb415975ec024f3e23da8509425af","src/api/reductions/min_max.rs":"6af8c9aa45c69961b1b6fc205395f4767d4421869fb105fb3d563c5605fc13cd","src/api/select.rs":"6b07e7e8026df561f7307221a896f0fbb272536f41b9109040ac094c24c69331","src/api/shuffle.rs":"26458aec2557bfab41b7765f72aefbff3a7ee08cdc689981a81f133f58ee368b","src/api/shuffle1_dyn.rs":"bfea5a91905b31444e9ef7ca6eddb7a9606b7e22d3f71bb842eb2795a0346620","src/api/slice.rs":"ee87484e8af329547b9a5d4f2a69e8bed6ea10bbd96270d706083843d4eea2ac","src/api/slice/from_slice.rs":"9b6f01ace2d12ef45c84608bb7aad3a122e2cc319b2d99170fc332a568b8de63","src/api/slice/write_to_slice.rs":"244b6bd6ccffa6e5a195f8b1abc66d94251b6d16b2ec3fe4d76d32caec68261e","src/api/swap_bytes.rs":"4a6792a2e49a77475e1b237592b4b2804dbddb79c474331acd0dd71b36934259","src/codegen.rs":"db4f232fb9f5728db310b87dc8c4733be48afacab1053798c06106bef9a42b05","src/codegen/bit_manip.rs":"525ea6ff7ad1e043b6f6136992166f1803ed5563b7f6fc292c1c40257d20e264","src/codegen/llvm.rs":"b4ccbc0bad90038f00fc3c158736462d01d0053df3afa00f9169e67d1a264444","src/codegen/math.rs":"dfcf02ad34e2fdfe22c3f1cc2822001cc895e65031b4d06e585e5047839febb7","src/codegen/math/float.rs":"2c1cbce155bc527ce34d472c0fef6bc3dadb79cd7a357dd7aa5b1ebeb1d77a13","src/codegen/math/float/abs.rs":"d5aaadcf540bdb9b4264dca6471a255fd7bf509e763bef0239c0144a68466fea","src/codegen/math/float/cos.rs":"17f28d2900c852dca221fa9c92a9cd5fe7fd2df8d427bbc60216c749b2be013d","src/codegen/math/float/cos_pi.rs":"dbaf9f443f9846a491d4ec52210a7b5835dd593b03366e3135b05c37d70f9d6c","src/codegen/math/float/exp.rs":"d300058a4bcc7ae7976f216f81902cd73a9e603ad63880dff3bbc866c27a9f37","src/codegen/math/float/ln.rs":"c851e211e43f8256093ba75b03ae0c307c9962ee66d94f09b4dd80068190cbdf","src/codegen/math/float/macros.rs":"fc9924869ed85e4795983af228cacf23158f4f35919adce16c920ad4a3f0a009","src/codegen/math/float/mul_add.rs":"041a5b69d5991d93ef795351b17560c10faf80b78fd26ad7df42a239b32cf9de","src/codegen/math/float/mul_adde.rs":"d71d5f0f3333b62a7439b823cb7adf5340ea1555ce820fb4a3f4cb922f73f5f5","src/codegen/math/float/powf.rs":"9742c3877f1a5509ca5c9492a40884b6579ba6dd11c26b7112e63f70666b395d","src/codegen/math/float/sin.rs":"0e9868d35531566509f3a01d85d5253045eb4afa8525d8407dcc1f5f33c56036","src/codegen/math/float/sin_cos_pi.rs":"8e6b6142d7dd240cdb36669722e82ab9810a2261e86e659f7d97a942ad8b1258","src/codegen/math/float/sin_pi.rs":"bb6d39db8f921e03a301fc5206ac1a61a97def8a2cb83b87ccf189f3fc48d548","src/codegen/math/float/sqrt.rs":"e6ebb0c5f428efad1f672b9a8fe4e58534dbf1ea5a8fe092ce5ce76b52fe89cb","src/codegen/math/float/sqrte.rs":"23acfaea38d0e081a6d9021c1094e813d0cfd12c58c1eca9662aade5e625d51c","src/codegen/pointer_sized_int.rs":"6ca13c214b6cf7e0929dbe18e96a16fc0bb7d8799608df29c4c8115490f99e01","src/codegen/reductions.rs":"8eb18ebac76985d2aa30262a2edd8cb004230b511a765d657525f677a585c12c","src/codegen/reductions/mask.rs":"e67f35a1f4d156a4894a2d6ea5a935b4d898cf70eefb2715f5c1cc165e776c11","src/codegen/reductions/mask/aarch64.rs":"84b101c17cad1ede4eb6d38cada0ac7da239dba8cea3badd3829b967e558431f","src/codegen/reductions/mask/arm.rs":"aaa07129bd078ae7e677cf8b8e67ec9f30536606a0c7ed1baaa18fd1793bb218","src/codegen/reductions/mask/fallback.rs":"3eb9319d2c7cf19216b607b8459612c4e027b643cf11b036937d36896bf76786","src/codegen/reductions/mask/fallback_impl.rs":"76547f396e55ef403327c77c314cf8db8c7a5c9b9819bfb925abeacf130249e5","src/codegen/reductions/mask/x86.rs":"36dcd8af4ab99730a078ed113d3955f74eb1a2876e2e6d9f224e0ff462c216d1","src/codegen/reductions/mask/x86/avx.rs":"3a40868b38c86e35aefb96d7578de6322efe89d8135e0366359b54ddd06f861a","src/codegen/reductions/mask/x86/avx2.rs":"677aed3f056285285daa3adff8bc65e739630b4424defa6d9665e160f027507e","src/codegen/reductions/mask/x86/sse.rs":"8522f6ed03f6c32dd577d4298df477c08aeaaa38563706f29096e1911ed731f2","src/codegen/reductions/mask/x86/sse2.rs":"54ec56e49b0c6841eccb719e4f310d65fe767c04136b2ec20bd8b9d7d9897b9e","src/codegen/shuffle.rs":"1ec2930f4e1acc43ac30b518af298d466a79e9e75734a51c380b7810efd1a27f","src/codegen/shuffle1_dyn.rs":"3f13ca1597378758d05106bf5ff3715eee531f3cb6d88f48b9182bd6c9386b51","src/codegen/swap_bytes.rs":"c67c86e91ca3fc77539e0efcea081a3c62548cccf503963ae408f2e86f4e6a21","src/codegen/v128.rs":"94226b31ec403d18d9d2fe06713f147c9c79e9b5f9105089088266313f843185","src/codegen/v16.rs":"ddec4ffb66b6f7aaffb9a1780c5ddba82557abd74f45073d335047e04cf74924","src/codegen/v256.rs":"6b63917f0444118d6b1595bff2045e59b97c4d24012bd575f69f1f0efc5a0241","src/codegen/v32.rs":"3477b3c5540aed86e61e2f5807dd31db947413cec9181c587d93ed6ec74f0eba","src/codegen/v512.rs":"5854f99d3aabc4cd42b28a20d9ce447756dc2ba024a409a69b6a8ae1f1842fc5","src/codegen/v64.rs":"e9e89caebfe63d10c0cbca61e4dfdba3b7e02ee0989170f80beed23237ddd950","src/codegen/vPtr.rs":"f0753b405cdc865bdf8e82c6505f299ea1f96136239ebbaf7f9ce93d310764b8","src/codegen/vSize.rs":"c89f5fdeb28ac4c8272ed1816fce03d9d95308cc32bb2533bd8b20cd5ac102ac","src/lib.rs":"b6f846d5d30cf6b035a2d18039aba7b2045cf89384733d643572bd68873ae064","src/masks.rs":"70fc0abe4c2907ce2a491c574e1cfb9f3423385da2e1a923a48c9c13f8ba6ed8","src/sealed.rs":"ae7fdeaf5d84cd7710ed730ca72ca7eaba93df6cb0acb183e5c0a7327acf197f","src/testing.rs":"896669c08d8c801448a4d2fadc9d633eda0fbe879d229997e2a182e31278e469","src/testing/macros.rs":"403bbc5ecb7c786fe36156df302d0c07a8122408dbb15f7474d7682224ba1106","src/testing/utils.rs":"41912a92266dfe884647fc035e4242fd746100df8e839808ae0397af3759a3c8","src/v128.rs":"16cf9a8e7156b899ee9b9cd3f2dba9d13ec63289bea8c3ee9ae2e43ad9510288","src/v16.rs":"cb6465cf1e00bf530183af1819b9fe3d7eec978f8765d5e85d9b58a39a4b4045","src/v256.rs":"fe235017da18c7f3c361831c60e3173ad304d8ea1e95d64ebebc79da2d708511","src/v32.rs":"145d347855bac59b2de6508f9e594654e6c330423af9edc0e2ac8f4d1abdf45e","src/v512.rs":"f372f277f3e62eb5c945bb1c460333fdb17b6974fcc876633788ff53bded9599","src/v64.rs":"0b8079881b71575e3414be0b7f8f7eaba65281ba6732f2b2f61f73e95b6f48f7","src/vPtr.rs":"8b3e433d487180bb4304ff71245ecad90f0010f43e139a72027b672abe58facc","src/vSize.rs":"eda5aa020706cbf94d15bada41a0c2a35fc8f3f37cb7c2cd6f34d201399a495e","tests/endianness.rs":"2783d727e8ff8789211e03120634cd3ad9f8972fc484012681b5b63cf89408a7"},"package":null}
8611 \ No newline at end of file
8612 +{"files":{".appveyor.yml":"f1ed01850e0d725f9498f52a1a63ddf40702ad6e0bf5b2d7c4c04d76e96794a3",".travis.yml":"30a61a5ec53355fc1f3585e1690280308c2b7961701abc11e8389b235b647178","Cargo.toml":"2cab084b3d55d0b307788b02a6206a3ec39fee027535dc62d6421bce70e2e2c1","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"fa4dd64f66972217d35b7653338c9e2011ccd8f3008ae7c0103272d4287f9b1d","bors.toml":"dee881dc69b9b7834e4eba5d95c3ed5a416d4628815a167d6a22d4cb4fb064b8","build.rs":"a766fba121243a9b617432c592873801adb74c3a2f4a24d9d45859b8ce9357fc","ci/all.sh":"2ae6b2445b4db83833e40b37efd0016c6b9879ee988b9b3ef94db5439a3e1606","ci/android-install-ndk.sh":"0f1746108cc30bf9b9ba45bcde7b19fc1a8bdf5b0258035b4eb8dc69b75efac4","ci/android-install-sdk.sh":"3490432022c5c8f5a115c084f7a9aca1626f96c0c87ffb62019228c4346b47e4","ci/android-sysimage.sh":"ebf4e5daa1f0fe1b2092b79f0f3f161c4c4275cb744e52352c4d81ab451e4c5a","ci/benchmark.sh":"b61d19ef6b90deba8fb79dee74c8b062d94844676293da346da87bb78a9a49a4","ci/deploy_and_run_on_ios_simulator.rs":"ec8ecf82d92072676aa47f0d1a3d021b60a7ae3531153ef12d2ff4541fc294dc","ci/docker/aarch64-linux-android/Dockerfile":"ace2e7d33c87bc0f6d3962a4a3408c04557646f7f51ab99cfbf574906796b016","ci/docker/aarch64-unknown-linux-gnu/Dockerfile":"da88c0d50f16dc08448c7fdf1fa5ed2cbe576acf9e7dd85b5b818621b2a8c702","ci/docker/arm-linux-androideabi/Dockerfile":"370e55d3330a413a3ccf677b3afb3e0ef9018a5fab263faa97ae8ac017fc2286","ci/docker/arm-unknown-linux-gnueabi/Dockerfile":"bb5f8ae890707c128652290ffc544447643bf12037ddd73c6ad6989f848cb380","ci/docker/arm-unknown-linux-gnueabihf/Dockerfile":"1afaefcbc05b740859acd4e067bc92439be6bcbe8f2e9678474fb434bcd398d9","ci/docker/armv7-unknown-linux-gnueabihf/Dockerfile":"8282ea707a94109beed47a57574755e2d58401735904a03f85fb64c578c53b4f","ci/docker/i586-unknown-linux-gnu/Dockerfile":"49792922269f371bd29da4727e9085101b27be67a6b97755d0196c63317f7abb","ci/docker/i686-unknown-linux-gnu/Dockerfile":"49792922269f371bd29da4727e9085101b27be67a6b97755d0196c63317f7abb","ci/docker/mips-unknown-linux-gnu/Dockerfile":"b2ebc25797612c4f8395fe9d407725156044955bfbcf442036b7f55b43a5f9da","ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile":"b0c1692ac65bc56dd30494b1993d8e929c48cc9c4b92029b7c7592af6d4f9220","ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile":"4e9249c179300138141d0b2b7401b11897f64aed69f541f078c1db4594df2827","ci/docker/mipsel-unknown-linux-musl/Dockerfile":"3164c52b0dcbb01afa78292b15b5c43503ccf0491cf6eb801ec2bf22ae274e52","ci/docker/powerpc-unknown-linux-gnu/Dockerfile":"786f799d0b56eb54d7b6c4b00e1aed4ce81776e14e44767e083c89d014b72004","ci/docker/powerpc64-unknown-linux-gnu/Dockerfile":"e8bc363837cd9c2d8b22402acb8c1c329efc11ba5d12170603d2fe2eae9da059","ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile":"47998d45b781d797b9e6085ebe898d90de0c952b54537a8db4e8d7503eb032d9","ci/docker/s390x-unknown-linux-gnu/Dockerfile":"93fb44df3d7fd31ead158570667c97b5076a05c3d968af4a84bc13819a8f2db8","ci/docker/sparc64-unknown-linux-gnu/Dockerfile":"da1c39a3ff1fe22e41395fa7c8934e90b4c1788e551b9aec6e38bfd94effc437","ci/docker/thumbv7neon-linux-androideabi/Dockerfile":"c2decd5591bd7a09378901bef629cd944acf052eb55e4f35b79eb9cb4d62246a","ci/docker/thumbv7neon-unknown-linux-gnueabihf/Dockerfile":"51955a8bf3c4d440f47382af6f5426ebff94ab01a04da36175babda9a057740f","ci/docker/wasm32-unknown-unknown/Dockerfile":"5a022299f56730cf8c432a07391e95e199cfa36dc8da2a96c9d185c8de93e913","ci/docker/x86_64-linux-android/Dockerfile":"685040273cf350d5509e580ac451555efa19790c8723ca2af066adadc6880ad2","ci/docker/x86_64-unknown-linux-gnu-emulated/Dockerfile":"44b6203d9290bfdc53d81219f0937e1110847a23dd982ec8c4de388354f01536","ci/docker/x86_64-unknown-linux-gnu/Dockerfile":"7f4e3ca5fa288ea70edb4d1f75309708cd30b192e2e4444e61c4d5b3b58f89cf","ci/dox.sh":"434e9611c52e389312d2b03564adf09429f10cc76fe66a8644adb104903b87b7","ci/linux-s390x.sh":"d6b732d7795b4ba131326aff893bca6228a7d2eb0e9402f135705413dbbe0dce","ci/linux-sparc64.sh":"c92966838b1ab7ad3b7a344833ee726aba6b647cf5952e56f0ad1ba420b13325","ci/lld-shim.rs":"3d7f71ec23a49e2b67f694a0168786f9a954dda15f5a138815d966643fd3fcc3","ci/max_line_width.sh":"0a1518bba4c9ecaa55694cb2e9930d0e19c265baabf73143f17f9cf285aaa5bb","ci/run-docker.sh":"92e036390ad9b0d16f109579df1b5ced2e72e9afea40c7d011400ebd3a2a90de","ci/run.sh":"41dd6a60efaaeae9661a01370cce98b631f78392859a0cf68c946c0a16edf5f7","ci/run_examples.sh":"d1a23c6c35374a0678ba5114b9b8fefd8be0a79e774872a8bf0898d1baca18d0","ci/runtest-android.rs":"145a8e9799a5223975061fe7e586ade5669ee4877a7d7a4cf6b4ab48e8e36c7c","ci/setup_benchmarks.sh":"fae3960023f6f3d1388cd2ad22fdbab4b075f1f29dd4292d7994a20783beb6cf","ci/test-runner-linux":"c8aa6025cff5306f4f31d0c61dc5f9d4dd5a1d189ab613ef8d4c367c694d9ccd","contributing.md":"2d2629310ad4d464c482bdbb5819f0d6ce223c576aeef2cdce6a1f6857085ea5","perf-guide/.gitignore":"fe82c7da551079d832cf74200b0b359b4df9828cb4a0416fa7384f07a2ae6a13","perf-guide/book.toml":"115a98284126c6b180178b44713314cc494f08a71662ee2ce15cf67f17a51064","perf-guide/src/SUMMARY.md":"3e03bffc991fdc2050f3d51842d72d9d21ea6abab56a3baf3b2d5973a78b89e1","perf-guide/src/ascii.css":"29afb08833b2fe2250f0412e1fa1161a2432a0820a14953c87124407417c741a","perf-guide/src/bound_checks.md":"5e4991ff58a183ef0cd9fdc1feb4cd12d083b44bdf87393bbb0927808ef3ce7d","perf-guide/src/float-math/approx.md":"8c09032fa2d795a0c5db1775826c850d28eb2627846d0965c60ee72de63735ad","perf-guide/src/float-math/fma.md":"311076ba4b741d604a82e74b83a8d7e8c318fcbd7f64c4392d1cf5af95c60243","perf-guide/src/float-math/fp.md":"04153e775ab6e4f0d7837bcc515230d327b04edfa34c84ce9c9e10ebaeef2be8","perf-guide/src/float-math/svml.md":"0798873b8eedaeda5fed62dc91645b57c20775a02d3cd74d8bd06958f1516506","perf-guide/src/introduction.md":"9f5a19e9e6751f25d2daad39891a0cc600974527ec4c8305843f9618910671bd","perf-guide/src/prof/linux.md":"447731eb5de7d69166728fdbc5ecb0c0c9db678ea493b45a592d67dd002184c0","perf-guide/src/prof/mca.md":"f56d54f3d20e7aa4d32052186e8237b03d65971eb5d112802b442570ff11d344","perf-guide/src/prof/profiling.md":"8a650c0fd6ede0964789bb6577557eeef1d8226a896788602ce61528e260e43c","perf-guide/src/target-feature/attribute.md":"615f88dca0a707b6c416fa605435dd6e1fb5361cc639429cbf68cd87624bd78b","perf-guide/src/target-feature/features.md":"17077760ff24c006b606dd21889c53d87228f4311f3ba3a574f9afdeacd86165","perf-guide/src/target-feature/inlining.md":"7ed1d7068d8173a00d84c16cfe5871cd68b9f04f8d0cca2d01ebc84957ebf2f6","perf-guide/src/target-feature/practice.md":"c4b371842e0086df178488fec97f20def8f0c62ee588bcd25fd948b9b1fa227e","perf-guide/src/target-feature/runtime.md":"835425f5ee597fb3e51d36e725a81ebee29f4561231d19563cd4da81dbb1cfcb","perf-guide/src/target-feature/rustflags.md":"01197acf6f0adec8db32b8591811f69cecb6555a2b05dc5d5ec27d0e3f7b065e","perf-guide/src/vert-hor-ops.md":"c6211c0ee91e60552ec592d89d9d957eedc21dee3cbd89e1ad6765ea06a27471","rustfmt.toml":"d99a43f3f8ef9e425cf01c333fba9f0051f888f5d87ab4e8f63c2f7d0fe6620f","src/api.rs":"bb1795e9657a8298d37d2349b45443f08e9e455399ad4b727018600728478c10","src/api/bit_manip.rs":"c47a4d0f7451f7e35d07715e4f39a472e07457fd456fdb726864a4f6887252a3","src/api/bitmask.rs":"6d2beefd62ee5d9c8eb060bee6abc641616bf828c99f82abf97b21bf004e894b","src/api/cast.rs":"03b94a3d316ac7b7be7068810044911e965e889a0ace7bae762749ca74a92747","src/api/cast/macros.rs":"b0a14d0c83ad2ebb7a275180f6d9e3f2bc312ba57a7d3d6c39fad4e0f20f9408","src/api/cast/v128.rs":"edd0994efac4379dff26e178423a52dbb3ffeb38b1fc97cae975d744c00b4fb6","src/api/cast/v16.rs":"96bd98c2d21b0663abe6c0ab33005b1fa693f3db7ee6795351391343863484da","src/api/cast/v256.rs":"8c31fe91f5e78ef737dfba6979cc1240210cb094a89d284fe459bf8a991ca24b","src/api/cast/v32.rs":"a99a79dd84d2a5e6adf9db98705675915bd03fd1287d489c7fe38e84d7e4a086","src/api/cast/v512.rs":"c0dd526f41ed7b8a71c3743d91267554ec0a0c75834ccc2e3ecb0ef3004af642","src/api/cast/v64.rs":"6572fdba2a1241a6cd666d3f0cce3306cd2cb7e5e236172e59d5d4351c8a88af","src/api/cmp.rs":"357c3a2a09c6d4611c32dd7fa95be2fae933d513e229026ec9b44451a77b884e","src/api/cmp/eq.rs":"60f70f355bae4cb5b17db53204cacc3890f70670611c17df638d4c04f7cc8075","src/api/cmp/ord.rs":"589f7234761c294fa5df8f525bc4acd5a47cdb602207d524a0d4e19804cd9695","src/api/cmp/partial_eq.rs":"902ccb8aa01fd5738b30ba0b712669c21d4801958907e03bad23432c7dba0198","src/api/cmp/partial_ord.rs":"9db0c37d7434cdfc62d8d66912e972fa3d8c115ab2af051a6f45e414bd3e4f1c","src/api/cmp/vertical.rs":"de3d62f38eba817299aa16f1e1939954c9a447e316509397465c2830852ba053","src/api/default.rs":"67bf21c134127d12a7028c8b88a57f0ceee8ccbd74976da8ca74eb9f16a174d5","src/api/fmt.rs":"67fb804bb86b6cd77cf8cd492b5733ce437071b66fe3297278b8a6552c325dda","src/api/fmt/binary.rs":"02b2b287f7404f8a983813cf70c87108c8da3835578b63ab303116885f609413","src/api/fmt/debug.rs":"56e1c3bdc092747344fffaafff9da7163ee7827857f6fb7cb1c9923eca4f6fa0","src/api/fmt/lower_hex.rs":"558fd592f7f485712fb051509cecc7174a21e6bf62e5ce64766e75afc97bb8e1","src/api/fmt/octal.rs":"3b2e70877a4f368c7704f8e254236c014c365c74d93371c1feb5f030e6c66422","src/api/fmt/upper_hex.rs":"2a442f666bc80e22d41f903f881238fe114dd49344c3ed69849250e853cafc5d","src/api/from.rs":"2e599d8329cb05eaf06224cc441355c4b7b51254fc19256619333be8c149d444","src/api/from/from_array.rs":"dd3fc64fb17d6184bb60343f8da26a05edf0e5f3c14caf55d49fa15e21d948dc","src/api/from/from_vector.rs":"9764371aa9e6005aace74dea14f59e5611a095b7cf42707940924749282c52f0","src/api/hash.rs":"5076ece87969592c876486f5b1ea8affbeaec379d1a14a30859e0aa5592019de","src/api/into_bits.rs":"1ee15923352786b9ab4a31fa506762297116b18cfdb8e72853abc8ad001651d2","src/api/into_bits/arch_specific.rs":"e7445021f3908326bfee758835e5fc5ad56aa1baa77fc1c58abe4350c66c670a","src/api/into_bits/macros.rs":"bb4fe99be2af6a21d805efab44c8e4e61a7b2adb42a65504a0cf26d13efdadcd","src/api/into_bits/v128.rs":"145a44922b09a5ca5b62d88a461d327d399a997a15db4b11d7b17e554a9fa4c0","src/api/into_bits/v16.rs":"f4f4f61ba88aa51b158ec56ca3dce234349aea0daf2b3029a14ab5125d1e41e5","src/api/into_bits/v256.rs":"8cea9c5d9809f11323cb7cdc53b83df593fd17caf926251e412ae9777bed547f","src/api/into_bits/v32.rs":"905ba683d342fa32f4202b80bb46530807bd0a5b588f6c2e8c9f475223c47775","src/api/into_bits/v512.rs":"e25afa1fbf088a5d58e7d75d197b6cd4c56637ea28542ba18e46a451f29d04e7","src/api/into_bits/v64.rs":"d6238022ccff7b92e55b3f6017fc269acb6f36330a6d7e8fb389853a0f1b6478","src/api/math.rs":"8b2a2fc651917a850539f993aa0b9e5bf4da67b11685285b8de8cdca311719ec","src/api/math/float.rs":"61d2794d68262a1090ae473bd30793b5f65cf732f32a6694a3af2ce5d9225616","src/api/math/float/abs.rs":"5b6b2701e2e11135b7ce58a05052ea8120e10e4702c95d046b9d21b827b26bf8","src/api/math/float/consts.rs":"6302c9261da4291d144d5bb53493cdd073498feb40955fb6860ea3c4d06c978a","src/api/math/float/cos.rs":"4c2dd7173728ef189314f1576c9486e03be21b7da98843b2f9011282a7979e31","src/api/math/float/exp.rs":"7c6d5f1e304f498a01cfa23b92380c815d7da0ad94eae3483783bc377d287eef","src/api/math/float/ln.rs":"54c7583f3df793b39ff57534fade27b41bb992439e5dc178252f5ca3190a3e54","src/api/math/float/mul_add.rs":"62cac77660d20159276d4c9ef066eb90c81cbddb808e8e157182c607625ad2eb","src/api/math/float/mul_adde.rs":"bae056ee9f3a70df39ec3c3b2f6437c65303888a7b843ef1a5bcf1f5aca0e602","src/api/math/float/powf.rs":"9ddb938984b36d39d82a82f862f80df8f7fb013f1d222d45698d41d88472f568","src/api/math/float/recpre.rs":"589225794ff1dbf31158dff660e6d4509ecc8befbb57c633900dea5ac0b840d6","src/api/math/float/rsqrte.rs":"a32abdcc318d7ccc8448231f54d75b884b7cbeb03a7d595713ab6243036f4dbf","src/api/math/float/sin.rs":"cbd3622b7df74f19691743001c8cf747a201f8977ad90542fee915f37dcd1e49","src/api/math/float/sqrt.rs":"0c66d5d63fb08e4d99c6b82a8828e41173aff1ac9fa1a2764a11fac217ccf2ac","src/api/math/float/sqrte.rs":"731e1c9f321b662accdd27dacb3aac2e8043b7aecb2f2161dde733bd9f025362","src/api/minimal.rs":"1f22bcc528555444e76de569ec0ae2029b9ae9d04805efeafa93369c8098036b","src/api/minimal/iuf.rs":"819cff26d3e196f807645bcc1d79eb27d9f175edb89910f2274d52a1e913cd11","src/api/minimal/mask.rs":"0cae10ae1fc65f5070e686c0c79bfba27b86b33d6c399367bd4848fb367dcec4","src/api/minimal/ptr.rs":"f65ebf21866a863485344432d9a7a9b7418f7fad5fdf841a4e2fa56ec0766ad0","src/api/ops.rs":"3e273b277a0f3019d42c3c59ca94a5afd4885d5ae6d2182e5089bbeec9de42ee","src/api/ops/scalar_arithmetic.rs":"d2d5ad897a59dd0787544f927e0e7ca4072c3e58b0f4a2324083312b0d5a21d7","src/api/ops/scalar_bitwise.rs":"482204e459ca6be79568e1c9f70adbe2d2151412ddf122fb2161be8ebb51c40c","src/api/ops/scalar_mask_bitwise.rs":"c250f52042e37b22d57256c80d4604104cfd2fbe2a2e127c676267270ca5d350","src/api/ops/scalar_shifts.rs":"c4773d435c3f9da4454327e6fbb2b5b41a1c0ebb1cca7372e69dc7a344a1b6e4","src/api/ops/vector_arithmetic.rs":"ddca15d09ddeef502c2ed66117a62300ca65d87e959e8b622d767bdf1c307910","src/api/ops/vector_bitwise.rs":"b3968f7005b649edcc22a54e2379b14d5ee19045f2e784029805781ae043b5ee","src/api/ops/vector_float_min_max.rs":"76bf8cb607e2c442923c1da1061a6b80d742d607408033c2a3761161114cf2a0","src/api/ops/vector_int_min_max.rs":"a378789c6ff9b32a51fbd0a97ffd36ed102cd1fe6a067d2b02017c1df342def6","src/api/ops/vector_mask_bitwise.rs":"5052d18517d765415d40327e6e8e55a312daaca0a5e2aec959bfa54b1675f9c8","src/api/ops/vector_neg.rs":"5c62f6b0221983cdbd23cd0a3af3672e6ba1255f0dfe8b19aae6fbd6503e231b","src/api/ops/vector_rotates.rs":"ee319eaaa449dc50ea8ef05b89d38519c6faa6753dfdce432ea7bb8520e4e8e7","src/api/ops/vector_shifts.rs":"e510be14127c0ffd58a2573a39701da3557d66bedec09837ac8bbd44d579da00","src/api/ptr.rs":"8a793251bed6130dcfb2f1519ceaa18b751bbb15875928d0fb6deb5a5e07523a","src/api/ptr/gather_scatter.rs":"3d614f9d5b4ca201a9f7e46af4405e1d2c28ecee1620297c23b52e37b92cc0ea","src/api/reductions.rs":"ae5baca81352ecd44526d6c30c0a1feeda475ec73ddd3c3ec6b14e944e5448ee","src/api/reductions/bitwise.rs":"8bf910ae226188bd15fc7e125f058cd2566b6186fcd0cd8fd020f352c39ce139","src/api/reductions/float_arithmetic.rs":"47a5679896db2cbb56c31372fe42143da015b6beae7db5d2f3a0309ddf427ae1","src/api/reductions/integer_arithmetic.rs":"c2df3cf7493cca4174f2c65aea422a3d20d8a23af03f8d57cef72c19fee8f20d","src/api/reductions/mask.rs":"db83327a950e33a317f37fd33ca4e20c347fb415975ec024f3e23da8509425af","src/api/reductions/min_max.rs":"6af8c9aa45c69961b1b6fc205395f4767d4421869fb105fb3d563c5605fc13cd","src/api/select.rs":"6b07e7e8026df561f7307221a896f0fbb272536f41b9109040ac094c24c69331","src/api/shuffle.rs":"26458aec2557bfab41b7765f72aefbff3a7ee08cdc689981a81f133f58ee368b","src/api/shuffle1_dyn.rs":"bfea5a91905b31444e9ef7ca6eddb7a9606b7e22d3f71bb842eb2795a0346620","src/api/slice.rs":"ee87484e8af329547b9a5d4f2a69e8bed6ea10bbd96270d706083843d4eea2ac","src/api/slice/from_slice.rs":"9b6f01ace2d12ef45c84608bb7aad3a122e2cc319b2d99170fc332a568b8de63","src/api/slice/write_to_slice.rs":"244b6bd6ccffa6e5a195f8b1abc66d94251b6d16b2ec3fe4d76d32caec68261e","src/api/swap_bytes.rs":"4a6792a2e49a77475e1b237592b4b2804dbddb79c474331acd0dd71b36934259","src/codegen.rs":"db4f232fb9f5728db310b87dc8c4733be48afacab1053798c06106bef9a42b05","src/codegen/bit_manip.rs":"525ea6ff7ad1e043b6f6136992166f1803ed5563b7f6fc292c1c40257d20e264","src/codegen/llvm.rs":"b4ccbc0bad90038f00fc3c158736462d01d0053df3afa00f9169e67d1a264444","src/codegen/math.rs":"dfcf02ad34e2fdfe22c3f1cc2822001cc895e65031b4d06e585e5047839febb7","src/codegen/math/float.rs":"2c1cbce155bc527ce34d472c0fef6bc3dadb79cd7a357dd7aa5b1ebeb1d77a13","src/codegen/math/float/abs.rs":"d5aaadcf540bdb9b4264dca6471a255fd7bf509e763bef0239c0144a68466fea","src/codegen/math/float/cos.rs":"17f28d2900c852dca221fa9c92a9cd5fe7fd2df8d427bbc60216c749b2be013d","src/codegen/math/float/cos_pi.rs":"dbaf9f443f9846a491d4ec52210a7b5835dd593b03366e3135b05c37d70f9d6c","src/codegen/math/float/exp.rs":"d300058a4bcc7ae7976f216f81902cd73a9e603ad63880dff3bbc866c27a9f37","src/codegen/math/float/ln.rs":"c851e211e43f8256093ba75b03ae0c307c9962ee66d94f09b4dd80068190cbdf","src/codegen/math/float/macros.rs":"fc9924869ed85e4795983af228cacf23158f4f35919adce16c920ad4a3f0a009","src/codegen/math/float/mul_add.rs":"041a5b69d5991d93ef795351b17560c10faf80b78fd26ad7df42a239b32cf9de","src/codegen/math/float/mul_adde.rs":"d71d5f0f3333b62a7439b823cb7adf5340ea1555ce820fb4a3f4cb922f73f5f5","src/codegen/math/float/powf.rs":"9742c3877f1a5509ca5c9492a40884b6579ba6dd11c26b7112e63f70666b395d","src/codegen/math/float/sin.rs":"0e9868d35531566509f3a01d85d5253045eb4afa8525d8407dcc1f5f33c56036","src/codegen/math/float/sin_cos_pi.rs":"8e6b6142d7dd240cdb36669722e82ab9810a2261e86e659f7d97a942ad8b1258","src/codegen/math/float/sin_pi.rs":"bb6d39db8f921e03a301fc5206ac1a61a97def8a2cb83b87ccf189f3fc48d548","src/codegen/math/float/sqrt.rs":"e6ebb0c5f428efad1f672b9a8fe4e58534dbf1ea5a8fe092ce5ce76b52fe89cb","src/codegen/math/float/sqrte.rs":"23acfaea38d0e081a6d9021c1094e813d0cfd12c58c1eca9662aade5e625d51c","src/codegen/pointer_sized_int.rs":"6ca13c214b6cf7e0929dbe18e96a16fc0bb7d8799608df29c4c8115490f99e01","src/codegen/reductions.rs":"8eb18ebac76985d2aa30262a2edd8cb004230b511a765d657525f677a585c12c","src/codegen/reductions/mask.rs":"e67f35a1f4d156a4894a2d6ea5a935b4d898cf70eefb2715f5c1cc165e776c11","src/codegen/reductions/mask/aarch64.rs":"84b101c17cad1ede4eb6d38cada0ac7da239dba8cea3badd3829b967e558431f","src/codegen/reductions/mask/arm.rs":"aaa07129bd078ae7e677cf8b8e67ec9f30536606a0c7ed1baaa18fd1793bb218","src/codegen/reductions/mask/fallback.rs":"3eb9319d2c7cf19216b607b8459612c4e027b643cf11b036937d36896bf76786","src/codegen/reductions/mask/fallback_impl.rs":"76547f396e55ef403327c77c314cf8db8c7a5c9b9819bfb925abeacf130249e5","src/codegen/reductions/mask/x86.rs":"36dcd8af4ab99730a078ed113d3955f74eb1a2876e2e6d9f224e0ff462c216d1","src/codegen/reductions/mask/x86/avx.rs":"3a40868b38c86e35aefb96d7578de6322efe89d8135e0366359b54ddd06f861a","src/codegen/reductions/mask/x86/avx2.rs":"677aed3f056285285daa3adff8bc65e739630b4424defa6d9665e160f027507e","src/codegen/reductions/mask/x86/sse.rs":"8522f6ed03f6c32dd577d4298df477c08aeaaa38563706f29096e1911ed731f2","src/codegen/reductions/mask/x86/sse2.rs":"54ec56e49b0c6841eccb719e4f310d65fe767c04136b2ec20bd8b9d7d9897b9e","src/codegen/shuffle.rs":"1ec2930f4e1acc43ac30b518af298d466a79e9e75734a51c380b7810efd1a27f","src/codegen/shuffle1_dyn.rs":"3f13ca1597378758d05106bf5ff3715eee531f3cb6d88f48b9182bd6c9386b51","src/codegen/swap_bytes.rs":"c67c86e91ca3fc77539e0efcea081a3c62548cccf503963ae408f2e86f4e6a21","src/codegen/v128.rs":"94226b31ec403d18d9d2fe06713f147c9c79e9b5f9105089088266313f843185","src/codegen/v16.rs":"ddec4ffb66b6f7aaffb9a1780c5ddba82557abd74f45073d335047e04cf74924","src/codegen/v256.rs":"6b63917f0444118d6b1595bff2045e59b97c4d24012bd575f69f1f0efc5a0241","src/codegen/v32.rs":"3477b3c5540aed86e61e2f5807dd31db947413cec9181c587d93ed6ec74f0eba","src/codegen/v512.rs":"5854f99d3aabc4cd42b28a20d9ce447756dc2ba024a409a69b6a8ae1f1842fc5","src/codegen/v64.rs":"e9e89caebfe63d10c0cbca61e4dfdba3b7e02ee0989170f80beed23237ddd950","src/codegen/vPtr.rs":"f0753b405cdc865bdf8e82c6505f299ea1f96136239ebbaf7f9ce93d310764b8","src/codegen/vSize.rs":"c89f5fdeb28ac4c8272ed1816fce03d9d95308cc32bb2533bd8b20cd5ac102ac","src/lib.rs":"b6f846d5d30cf6b035a2d18039aba7b2045cf89384733d643572bd68873ae064","src/masks.rs":"70fc0abe4c2907ce2a491c574e1cfb9f3423385da2e1a923a48c9c13f8ba6ed8","src/sealed.rs":"ae7fdeaf5d84cd7710ed730ca72ca7eaba93df6cb0acb183e5c0a7327acf197f","src/testing.rs":"896669c08d8c801448a4d2fadc9d633eda0fbe879d229997e2a182e31278e469","src/testing/macros.rs":"403bbc5ecb7c786fe36156df302d0c07a8122408dbb15f7474d7682224ba1106","src/testing/utils.rs":"41912a92266dfe884647fc035e4242fd746100df8e839808ae0397af3759a3c8","src/v128.rs":"16cf9a8e7156b899ee9b9cd3f2dba9d13ec63289bea8c3ee9ae2e43ad9510288","src/v16.rs":"cb6465cf1e00bf530183af1819b9fe3d7eec978f8765d5e85d9b58a39a4b4045","src/v256.rs":"fe235017da18c7f3c361831c60e3173ad304d8ea1e95d64ebebc79da2d708511","src/v32.rs":"145d347855bac59b2de6508f9e594654e6c330423af9edc0e2ac8f4d1abdf45e","src/v512.rs":"f372f277f3e62eb5c945bb1c460333fdb17b6974fcc876633788ff53bded9599","src/v64.rs":"0b8079881b71575e3414be0b7f8f7eaba65281ba6732f2b2f61f73e95b6f48f7","src/vPtr.rs":"8b3e433d487180bb4304ff71245ecad90f0010f43e139a72027b672abe58facc","src/vSize.rs":"eda5aa020706cbf94d15bada41a0c2a35fc8f3f37cb7c2cd6f34d201399a495e","tests/endianness.rs":"2783d727e8ff8789211e03120634cd3ad9f8972fc484012681b5b63cf89408a7"},"package":null}
8613 \ No newline at end of file