From bd98581c57bea3e4545e6886d0bddf822efc5c8b Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Thu, 1 Apr 2021 15:14:48 -0700 Subject: Upgrade rust/crates/bstr to 0.2.15 Test: make Change-Id: I38f3d51e38afe5595ccacc22913866f09150654b --- .cargo_vcs_info.json | 2 +- Android.bp | 2 +- Cargo.toml | 4 ++-- Cargo.toml.orig | 4 ++-- METADATA | 11 +++++------ src/impls.rs | 19 +++++++++++++++++-- 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 "] 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 "] 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: &mut G) -> BString { + fn arbitrary(g: &mut Gen) -> BString { BString::from(Vec::::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); +} -- cgit v1.2.3