aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Galenson <jgalenson@google.com>2021-04-02 17:37:12 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-04-02 17:37:12 +0000
commit8b1f9f5665637b352708a21bd657b33a17e5fa75 (patch)
treef115e489fc4c165ec9a575b2f69de53585b2f571
parent093487b7f97e3f14e907c1f8aa6ba520533750ea (diff)
parent80b83d98ceb404016232875a04b1b6b5d7a1f384 (diff)
downloadbstr-android12-qpr3-s5-release.tar.gz
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/bstr/+/1661990 Change-Id: Iee6bed39cc4333e243dcbc0ed6546c50416f06a7
-rw-r--r--.cargo_vcs_info.json2
-rw-r--r--Android.bp2
-rw-r--r--Cargo.toml4
-rw-r--r--Cargo.toml.orig4
-rw-r--r--METADATA11
-rw-r--r--src/impls.rs19
6 files changed, 28 insertions, 14 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 2ecf829..f1ec46c 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
{
"git": {
- "sha1": "7f0ad15d9628c0abec8cf6b7585539cae63e6d5b"
+ "sha1": "a444256ca7407fe180ee32534688549655b7a38e"
}
}
diff --git a/Android.bp b/Android.bp
index f7dff1d..5bb6b68 100644
--- a/Android.bp
+++ b/Android.bp
@@ -60,7 +60,7 @@ rust_library {
}
// dependent_library ["feature_list"]
-// byteorder-1.4.2
+// byteorder-1.4.3
// lazy_static-1.4.0
// memchr-2.3.4 "std,use_std"
// regex-automata-0.1.9
diff --git a/Cargo.toml b/Cargo.toml
index b4215b4..f02d695 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,7 +12,7 @@
[package]
name = "bstr"
-version = "0.2.14"
+version = "0.2.15"
authors = ["Andrew Gallant <jamslam@gmail.com>"]
exclude = ["/.github"]
description = "A string type that is not required to be valid UTF-8."
@@ -46,7 +46,7 @@ version = "1.0.85"
optional = true
default-features = false
[dev-dependencies.quickcheck]
-version = "0.8.1"
+version = "1"
default-features = false
[dev-dependencies.ucd-parse]
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index 63388bc..585da1b 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
[package]
name = "bstr"
-version = "0.2.14" #:version
+version = "0.2.15" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = "A string type that is not required to be valid UTF-8."
documentation = "https://docs.rs/bstr"
@@ -33,7 +33,7 @@ regex-automata = { version = "0.1.5", default-features = false, optional = true
serde = { version = "1.0.85", default-features = false, optional = true }
[dev-dependencies]
-quickcheck = { version = "0.8.1", default-features = false }
+quickcheck = { version = "1", default-features = false }
ucd-parse = "0.1.3"
unicode-segmentation = "1.2.1"
diff --git a/METADATA b/METADATA
index 1731bb3..b51a02f 100644
--- a/METADATA
+++ b/METADATA
@@ -7,14 +7,13 @@ third_party {
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/bstr/bstr-0.2.14.crate"
+ value: "https://static.crates.io/crates/bstr/bstr-0.2.15.crate"
}
- version: "0.2.14"
- # Dual-licensed, using the least restrictive per go/thirdpartylicenses#same.
+ version: "0.2.15"
license_type: NOTICE
last_upgrade_date {
- year: 2020
- month: 12
- day: 21
+ year: 2021
+ month: 4
+ day: 1
}
}
diff --git a/src/impls.rs b/src/impls.rs
index c7d0be3..4cba48e 100644
--- a/src/impls.rs
+++ b/src/impls.rs
@@ -33,7 +33,7 @@ macro_rules! impl_partial_eq_cow {
#[inline]
fn eq(&self, other: &$lhs) -> bool {
let this: &[u8] = (&**other).as_ref();
- PartialEq::eq(this, other.as_bytes())
+ PartialEq::eq(this, self.as_bytes())
}
}
};
@@ -938,7 +938,7 @@ mod bstring_arbitrary {
use quickcheck::{Arbitrary, Gen};
impl Arbitrary for BString {
- fn arbitrary<G: Gen>(g: &mut G) -> BString {
+ fn arbitrary(g: &mut Gen) -> BString {
BString::from(Vec::<u8>::arbitrary(g))
}
@@ -967,3 +967,18 @@ fn test_debug() {
B(&format!("{:?}", b"\xFF\xEF\xBF\xBD\xFF".as_bstr())).as_bstr(),
);
}
+
+// See: https://github.com/BurntSushi/bstr/issues/82
+#[test]
+fn test_cows_regression() {
+ use crate::ByteSlice;
+ use std::borrow::Cow;
+
+ let c1 = Cow::from(b"hello bstr".as_bstr());
+ let c2 = b"goodbye bstr".as_bstr();
+ assert_ne!(c1, c2);
+
+ let c3 = Cow::from("hello str");
+ let c4 = "goodbye str";
+ assert_ne!(c3, c4);
+}