summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Galenson <jgalenson@google.com>2021-10-14 18:22:38 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-10-14 18:22:38 +0000
commit343426767819a4061c64ccd37996ec8cd4b45f80 (patch)
treea96b08803f6c430424c1efffe42f6809632585fd
parent798360f1e01482b581ec8604dde6903e7a46ac59 (diff)
parenta25e6cc8ad8ada0c735d7c2ddff38391a2fada48 (diff)
downloadmatches-343426767819a4061c64ccd37996ec8cd4b45f80.tar.gz
Merge "Upgrade rust/crates/matches to 0.1.9" am: 22c4ce6c9b am: a25e6cc8ad
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/matches/+/1832700 Change-Id: I4c2c3daa4ee11e1a3fc7a0bc674f3646c56989e0
-rw-r--r--Android.bp43
-rw-r--r--Cargo.toml4
-rw-r--r--Cargo.toml.orig2
-rw-r--r--METADATA10
-rw-r--r--lib.rs5
-rw-r--r--patches/std.diff13
-rw-r--r--tests/use_star.rs10
7 files changed, 70 insertions, 17 deletions
diff --git a/Android.bp b/Android.bp
index e0d1ff8..2811c94 100644
--- a/Android.bp
+++ b/Android.bp
@@ -23,6 +23,8 @@ rust_library {
// has rustc warnings
host_supported: true,
crate_name: "matches",
+ cargo_env_compat: true,
+ cargo_pkg_version: "0.1.9",
srcs: ["lib.rs"],
edition: "2015",
apex_available: [
@@ -33,10 +35,12 @@ rust_library {
}
rust_defaults {
- name: "matches_defaults",
+ name: "matches_test_defaults",
crate_name: "matches",
// has rustc warnings
srcs: ["lib.rs"],
+ cargo_env_compat: true,
+ cargo_pkg_version: "0.1.9",
test_suites: ["general-tests"],
auto_gen_config: true,
edition: "2015",
@@ -44,7 +48,7 @@ rust_defaults {
rust_test_host {
name: "matches_host_test_lib",
- defaults: ["matches_defaults"],
+ defaults: ["matches_test_defaults"],
test_options: {
unit_test: true,
},
@@ -52,14 +56,14 @@ rust_test_host {
rust_test {
name: "matches_device_test_lib",
- defaults: ["matches_defaults"],
+ defaults: ["matches_test_defaults"],
}
rust_defaults {
- name: "matches_defaults_macro_use_one",
- crate_name: "macro_use_one",
- // has rustc warnings
- srcs: ["tests/macro_use_one.rs"],
+ name: "matches_test_defaults_matches",
+ crate_name: "matches",
+ cargo_env_compat: true,
+ cargo_pkg_version: "0.1.9",
test_suites: ["general-tests"],
auto_gen_config: true,
edition: "2015",
@@ -70,7 +74,9 @@ rust_defaults {
rust_test_host {
name: "matches_host_test_tests_macro_use_one",
- defaults: ["matches_defaults_macro_use_one"],
+ defaults: ["matches_test_defaults_matches"],
+ // has rustc warnings
+ srcs: ["tests/macro_use_one.rs"],
test_options: {
unit_test: true,
},
@@ -78,5 +84,24 @@ rust_test_host {
rust_test {
name: "matches_device_test_tests_macro_use_one",
- defaults: ["matches_defaults_macro_use_one"],
+ defaults: ["matches_test_defaults_matches"],
+ // has rustc warnings
+ srcs: ["tests/macro_use_one.rs"],
+}
+
+rust_test_host {
+ name: "matches_host_test_tests_use_star",
+ defaults: ["matches_test_defaults_matches"],
+ // has rustc warnings
+ srcs: ["tests/use_star.rs"],
+ test_options: {
+ unit_test: true,
+ },
+}
+
+rust_test {
+ name: "matches_device_test_tests_use_star",
+ defaults: ["matches_test_defaults_matches"],
+ // has rustc warnings
+ srcs: ["tests/use_star.rs"],
}
diff --git a/Cargo.toml b/Cargo.toml
index 030159e..57a249a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,7 +3,7 @@
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
-# to registry (e.g. crates.io) dependencies
+# to registry (e.g., crates.io) dependencies
#
# If you believe there's an error in this file please file an
# issue against the rust-lang/cargo repository. If you're
@@ -12,7 +12,7 @@
[package]
name = "matches"
-version = "0.1.8"
+version = "0.1.9"
authors = ["Simon Sapin <simon.sapin@exyr.org>"]
description = "A macro to evaluate, as a boolean, whether an expression matches a pattern."
documentation = "https://docs.rs/matches/"
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index afc7422..bf12269 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
[package]
name = "matches"
-version = "0.1.8"
+version = "0.1.9"
authors = ["Simon Sapin <simon.sapin@exyr.org>"]
license = "MIT"
repository = "https://github.com/SimonSapin/rust-std-candidates"
diff --git a/METADATA b/METADATA
index 2848b7a..5a786dc 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@ third_party {
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/matches/matches-0.1.8.crate"
+ value: "https://static.crates.io/crates/matches/matches-0.1.9.crate"
}
- version: "0.1.8"
+ version: "0.1.9"
license_type: NOTICE
last_upgrade_date {
- year: 2020
- month: 12
- day: 15
+ year: 2021
+ month: 9
+ day: 23
}
}
diff --git a/lib.rs b/lib.rs
index b183925..01ccbf9 100644
--- a/lib.rs
+++ b/lib.rs
@@ -1,3 +1,8 @@
+#![no_std]
+
+// ANDROID: Use std to allow building as a dylib.
+extern crate std;
+
/// Check if an expression matches a refutable pattern.
///
/// Syntax: `matches!(` *expression* `,` *pattern* `)`
diff --git a/patches/std.diff b/patches/std.diff
new file mode 100644
index 0000000..371910c
--- /dev/null
+++ b/patches/std.diff
@@ -0,0 +1,13 @@
+diff --git a/lib.rs b/lib.rs
+index 3bcd6e2..01ccbf9 100644
+--- a/lib.rs
++++ b/lib.rs
+@@ -1,5 +1,8 @@
+ #![no_std]
+
++// ANDROID: Use std to allow building as a dylib.
++extern crate std;
++
+ /// Check if an expression matches a refutable pattern.
+ ///
+ /// Syntax: `matches!(` *expression* `,` *pattern* `)`
diff --git a/tests/use_star.rs b/tests/use_star.rs
new file mode 100644
index 0000000..58a670b
--- /dev/null
+++ b/tests/use_star.rs
@@ -0,0 +1,10 @@
+//! https://github.com/SimonSapin/rust-std-candidates/issues/22
+
+extern crate matches;
+
+use matches::*;
+
+#[test]
+fn test_assert_matches() {
+ assert_matches!(4, 4)
+}