diff options
Diffstat (limited to 'vendor/semver/src')
-rw-r--r-- | vendor/semver/src/error.rs | 2 | ||||
-rw-r--r-- | vendor/semver/src/lib.rs | 2 | ||||
-rw-r--r-- | vendor/semver/src/parse.rs | 4 |
3 files changed, 7 insertions, 1 deletions
diff --git a/vendor/semver/src/error.rs b/vendor/semver/src/error.rs index a514e3f11..93b05ee8d 100644 --- a/vendor/semver/src/error.rs +++ b/vendor/semver/src/error.rs @@ -2,6 +2,7 @@ use crate::parse::Error; use core::fmt::{self, Debug, Display}; pub(crate) enum ErrorKind { + Empty, UnexpectedEnd(Position), UnexpectedChar(Position, char), UnexpectedCharAfter(Position, char), @@ -31,6 +32,7 @@ impl std::error::Error for Error {} impl Display for Error { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { match &self.kind { + ErrorKind::Empty => formatter.write_str("empty string, expected a semver version"), ErrorKind::UnexpectedEnd(pos) => { write!(formatter, "unexpected end of input while parsing {}", pos) } diff --git a/vendor/semver/src/lib.rs b/vendor/semver/src/lib.rs index 32ed96d1c..d6a8fe3fd 100644 --- a/vendor/semver/src/lib.rs +++ b/vendor/semver/src/lib.rs @@ -60,7 +60,7 @@ //! //! [Specifying Dependencies]: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html -#![doc(html_root_url = "https://docs.rs/semver/1.0.16")] +#![doc(html_root_url = "https://docs.rs/semver/1.0.17")] #![cfg_attr(doc_cfg, feature(doc_cfg))] #![cfg_attr(all(not(feature = "std"), not(no_alloc_crate)), no_std)] #![cfg_attr(not(no_unsafe_op_in_unsafe_fn_lint), deny(unsafe_op_in_unsafe_fn))] diff --git a/vendor/semver/src/parse.rs b/vendor/semver/src/parse.rs index 6a8f6ffba..e92d87abc 100644 --- a/vendor/semver/src/parse.rs +++ b/vendor/semver/src/parse.rs @@ -26,6 +26,10 @@ impl FromStr for Version { type Err = Error; fn from_str(text: &str) -> Result<Self, Self::Err> { + if text.is_empty() { + return Err(Error::new(ErrorKind::Empty)); + } + let mut pos = Position::Major; let (major, text) = numeric_identifier(text, pos)?; let text = dot(text, pos)?; |