aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Vander Stoep <jeffv@google.com>2023-04-03 13:37:23 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-04-03 13:37:23 +0000
commit7bdcf274adf6e0e5bb8eb7d76d2a8152def597a0 (patch)
tree8d9f6d7719ba1ff0dc5cdbd5c35fea9dfaa2ef8a
parent9a6cdeac5cff584419cb604e80982a6383fc9a7c (diff)
parent44b506f1bbcad4268d0a6d710b6152572db2831a (diff)
downloadsemver-7bdcf274adf6e0e5bb8eb7d76d2a8152def597a0.tar.gz
Upgrade semver to 1.0.17 am: 55c2df20e6 am: 44b506f1bb
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/semver/+/2519540 Change-Id: I2a1098942633a4553b82ec32ac199af0fbfaeb1f Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--.cargo_vcs_info.json2
-rw-r--r--.github/workflows/ci.yml17
-rw-r--r--Android.bp2
-rw-r--r--Cargo.toml4
-rw-r--r--Cargo.toml.orig2
-rw-r--r--LICENSE-APACHE25
-rw-r--r--METADATA10
-rw-r--r--src/error.rs2
-rw-r--r--src/lib.rs2
-rw-r--r--src/parse.rs4
-rw-r--r--tests/test_autotrait.rs2
-rw-r--r--tests/test_version.rs5
12 files changed, 36 insertions, 41 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 54870e9..f1fdee4 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,6 +1,6 @@
{
"git": {
- "sha1": "dda4b834a9c896d7e1c8d17d5e326386bb346b50"
+ "sha1": "1b162e8dd2283a62380c30b04cf8444c9c194d5c"
},
"path_in_vcs": ""
} \ No newline at end of file
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 0bfe3a7..8acd5fc 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -3,6 +3,7 @@ name: CI
on:
push:
pull_request:
+ workflow_dispatch:
schedule: [cron: "40 1 * * *"]
permissions:
@@ -12,8 +13,13 @@ env:
RUSTFLAGS: -Dwarnings
jobs:
+ pre_ci:
+ uses: dtolnay/.github/.github/workflows/pre_ci.yml@master
+
test:
name: Rust ${{matrix.rust}}
+ needs: pre_ci
+ if: needs.pre_ci.outputs.continue
runs-on: ubuntu-latest
strategy:
fail-fast: false
@@ -25,6 +31,9 @@ jobs:
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{matrix.rust}}
+ - name: Enable type layout randomization
+ run: echo RUSTFLAGS=${RUSTFLAGS}\ -Zrandomize-layout >> $GITHUB_ENV
+ if: matrix.rust == 'nightly'
- run: cargo test
- run: cargo check --no-default-features
- run: cargo check --features serde
@@ -32,6 +41,8 @@ jobs:
node:
name: Node
+ needs: pre_ci
+ if: needs.pre_ci.outputs.continue
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
@@ -54,6 +65,8 @@ jobs:
miri:
name: Miri
+ needs: pre_ci
+ if: needs.pre_ci.outputs.continue
runs-on: ubuntu-latest
env:
MIRIFLAGS: -Zmiri-strict-provenance
@@ -72,13 +85,15 @@ jobs:
fuzz:
name: Fuzz
+ needs: pre_ci
+ if: needs.pre_ci.outputs.continue
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
- uses: dtolnay/install@cargo-fuzz
- - run: cargo fuzz build -O
+ - run: cargo fuzz check
outdated:
name: Outdated
diff --git a/Android.bp b/Android.bp
index 500f53f..f148121 100644
--- a/Android.bp
+++ b/Android.bp
@@ -41,7 +41,7 @@ rust_library {
name: "libsemver",
crate_name: "semver",
cargo_env_compat: true,
- cargo_pkg_version: "1.0.16",
+ cargo_pkg_version: "1.0.17",
srcs: ["src/lib.rs"],
edition: "2018",
features: [
diff --git a/Cargo.toml b/Cargo.toml
index e0bfea2..e7fcfb7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@
edition = "2018"
rust-version = "1.31"
name = "semver"
-version = "1.0.16"
+version = "1.0.17"
authors = ["David Tolnay <dtolnay@gmail.com>"]
description = "Parser and evaluator for Cargo's flavor of Semantic Versioning"
documentation = "https://docs.rs/semver"
@@ -27,11 +27,11 @@ license = "MIT OR Apache-2.0"
repository = "https://github.com/dtolnay/semver"
[package.metadata.docs.rs]
-targets = ["x86_64-unknown-linux-gnu"]
rustdoc-args = [
"--cfg",
"doc_cfg",
]
+targets = ["x86_64-unknown-linux-gnu"]
[lib]
doc-scrape-examples = false
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index 307c361..30ee98e 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
[package]
name = "semver"
-version = "1.0.16"
+version = "1.0.17"
authors = ["David Tolnay <dtolnay@gmail.com>"]
categories = ["data-structures", "no-std"]
description = "Parser and evaluator for Cargo's flavor of Semantic Versioning"
diff --git a/LICENSE-APACHE b/LICENSE-APACHE
index 16fe87b..1b5ec8b 100644
--- a/LICENSE-APACHE
+++ b/LICENSE-APACHE
@@ -174,28 +174,3 @@ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
-
-APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
-Copyright [yyyy] [name of copyright owner]
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
diff --git a/METADATA b/METADATA
index 886c058..642e29a 100644
--- a/METADATA
+++ b/METADATA
@@ -11,13 +11,13 @@ third_party {
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/semver/semver-1.0.16.crate"
+ value: "https://static.crates.io/crates/semver/semver-1.0.17.crate"
}
- version: "1.0.16"
+ version: "1.0.17"
license_type: NOTICE
last_upgrade_date {
- year: 2022
- month: 12
- day: 19
+ year: 2023
+ month: 4
+ day: 3
}
}
diff --git a/src/error.rs b/src/error.rs
index a514e3f..93b05ee 100644
--- a/src/error.rs
+++ b/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/src/lib.rs b/src/lib.rs
index 32ed96d..d6a8fe3 100644
--- a/src/lib.rs
+++ b/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/src/parse.rs b/src/parse.rs
index 6a8f6ff..e92d87a 100644
--- a/src/parse.rs
+++ b/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)?;
diff --git a/tests/test_autotrait.rs b/tests/test_autotrait.rs
index af8534b..5d16689 100644
--- a/tests/test_autotrait.rs
+++ b/tests/test_autotrait.rs
@@ -1,3 +1,5 @@
+#![allow(clippy::extra_unused_type_parameters)]
+
fn assert_send_sync<T: Send + Sync>() {}
#[test]
diff --git a/tests/test_version.rs b/tests/test_version.rs
index 93a528c..de3628f 100644
--- a/tests/test_version.rs
+++ b/tests/test_version.rs
@@ -12,10 +12,7 @@ use semver::{BuildMetadata, Prerelease, Version};
#[test]
fn test_parse() {
let err = version_err("");
- assert_to_string(
- err,
- "unexpected end of input while parsing major version number",
- );
+ assert_to_string(err, "empty string, expected a semver version");
let err = version_err(" ");
assert_to_string(