From 3de77e86ff4539eb14762a6634ccdf334ffff02f Mon Sep 17 00:00:00 2001 From: Amanieu d'Antras Date: Sun, 28 Apr 2024 11:33:05 +0100 Subject: [PATCH 1/4] Revert "Make HashSet::insert return OccupiedEntry" This reverts commit 9beb0d26184d8c2d472afdf2199c42c6f3fadc96. --- src/set.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/set.rs b/src/set.rs index 0ade464dc..2125a7ac8 100644 --- a/src/set.rs +++ b/src/set.rs @@ -1003,7 +1003,7 @@ where /// match singles.entry(ch) { /// Vacant(single_entry) => { /// // We found a new character for the first time. - /// single_entry.insert(); + /// single_entry.insert() /// } /// Occupied(single_entry) => { /// // We've already seen this once, "move" it to dupes. @@ -2211,7 +2211,7 @@ impl fmt::Debug for OccupiedEntry<'_, T, S, A> { /// /// // Nonexistent key (insert) /// match set.entry("b") { -/// Entry::Vacant(view) => { view.insert(); }, +/// Entry::Vacant(view) => view.insert(), /// Entry::Occupied(_) => unreachable!(), /// } /// assert!(set.contains("b") && set.len() == 2); @@ -2247,7 +2247,7 @@ impl<'a, T, S, A: Allocator> Entry<'a, T, S, A> { { match self { Entry::Occupied(entry) => entry, - Entry::Vacant(entry) => entry.insert(), + Entry::Vacant(entry) => entry.insert_entry(), } } @@ -2442,7 +2442,16 @@ impl<'a, T, S, A: Allocator> VacantEntry<'a, T, S, A> { /// assert!(set.contains("poneyland")); /// ``` #[cfg_attr(feature = "inline-more", inline)] - pub fn insert(self) -> OccupiedEntry<'a, T, S, A> + pub fn insert(self) + where + T: Hash, + S: BuildHasher, + { + self.inner.insert(()); + } + + #[cfg_attr(feature = "inline-more", inline)] + fn insert_entry(self) -> OccupiedEntry<'a, T, S, A> where T: Hash, S: BuildHasher, From 47ef09fa217cffa672035e26e9bcb01b26ca8c28 Mon Sep 17 00:00:00 2001 From: Amanieu d'Antras Date: Sun, 28 Apr 2024 12:45:06 +0100 Subject: [PATCH 2/4] Release v0.14.5 --- CHANGELOG.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5eb18ab25..8c4068089 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,16 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/). ## [Unreleased] -## [v0.14.4] - 2024-03-19 - ### Changed - Changed `hash_set::{Entry, VacantEntry}::insert` to return `OccupiedEntry`. (#495) +## [v0.14.5] - 2024-04-28 + ### Fixed - Fixed index calculation in panic guard of `clone_from_impl`. (#511) +## ~~[v0.14.4] - 2024-03-19~~ + +This release was _yanked_ due to a breaking change. + ## [v0.14.3] - 2023-11-26 ### Added @@ -481,7 +485,8 @@ This release was _yanked_ due to a breaking change for users of `no-default-feat - Initial release -[Unreleased]: https://github.com/rust-lang/hashbrown/compare/v0.14.4...HEAD +[Unreleased]: https://github.com/rust-lang/hashbrown/compare/v0.14.5...HEAD +[v0.14.5]: https://github.com/rust-lang/hashbrown/compare/v0.14.4...v0.14.5 [v0.14.4]: https://github.com/rust-lang/hashbrown/compare/v0.14.3...v0.14.4 [v0.14.3]: https://github.com/rust-lang/hashbrown/compare/v0.14.2...v0.14.3 [v0.14.2]: https://github.com/rust-lang/hashbrown/compare/v0.14.1...v0.14.2 From adae598ff5e48a385a5eddbcd3e60c1cda40d0e9 Mon Sep 17 00:00:00 2001 From: Amanieu d'Antras Date: Sun, 28 Apr 2024 12:45:16 +0100 Subject: [PATCH 3/4] Reapply "Make HashSet::insert return OccupiedEntry" This reverts commit 3de77e86ff4539eb14762a6634ccdf334ffff02f. --- src/set.rs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/set.rs b/src/set.rs index 2125a7ac8..0ade464dc 100644 --- a/src/set.rs +++ b/src/set.rs @@ -1003,7 +1003,7 @@ where /// match singles.entry(ch) { /// Vacant(single_entry) => { /// // We found a new character for the first time. - /// single_entry.insert() + /// single_entry.insert(); /// } /// Occupied(single_entry) => { /// // We've already seen this once, "move" it to dupes. @@ -2211,7 +2211,7 @@ impl fmt::Debug for OccupiedEntry<'_, T, S, A> { /// /// // Nonexistent key (insert) /// match set.entry("b") { -/// Entry::Vacant(view) => view.insert(), +/// Entry::Vacant(view) => { view.insert(); }, /// Entry::Occupied(_) => unreachable!(), /// } /// assert!(set.contains("b") && set.len() == 2); @@ -2247,7 +2247,7 @@ impl<'a, T, S, A: Allocator> Entry<'a, T, S, A> { { match self { Entry::Occupied(entry) => entry, - Entry::Vacant(entry) => entry.insert_entry(), + Entry::Vacant(entry) => entry.insert(), } } @@ -2442,16 +2442,7 @@ impl<'a, T, S, A: Allocator> VacantEntry<'a, T, S, A> { /// assert!(set.contains("poneyland")); /// ``` #[cfg_attr(feature = "inline-more", inline)] - pub fn insert(self) - where - T: Hash, - S: BuildHasher, - { - self.inner.insert(()); - } - - #[cfg_attr(feature = "inline-more", inline)] - fn insert_entry(self) -> OccupiedEntry<'a, T, S, A> + pub fn insert(self) -> OccupiedEntry<'a, T, S, A> where T: Hash, S: BuildHasher, From 232df8cdf3ca73afbb871d79a068f49a15d07fe8 Mon Sep 17 00:00:00 2001 From: Amanieu d'Antras Date: Sun, 28 Apr 2024 12:58:04 +0100 Subject: [PATCH 4/4] Adjust Github CI since macos-latest is now AArch64 --- .github/workflows/rust.yml | 4 ++-- ci/run.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index d60a8e28f..e30f34c97 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -60,13 +60,13 @@ jobs: channel: [1.74.0, nightly] include: - os: macos-latest - target: x86_64-apple-darwin + target: aarch64-apple-darwin channel: nightly - os: windows-latest target: x86_64-pc-windows-msvc channel: nightly - os: macos-latest - target: x86_64-apple-darwin + target: aarch64-apple-darwin channel: 1.74.0 - os: windows-latest target: x86_64-pc-windows-msvc diff --git a/ci/run.sh b/ci/run.sh index 649877723..3990ccd2b 100644 --- a/ci/run.sh +++ b/ci/run.sh @@ -5,7 +5,7 @@ set -ex : "${TARGET?The TARGET environment variable must be set.}" case "${TARGET}" in - x86_64-unknown-linux-gnu|x86_64-apple-darwin|x86_64-pc-windows-msvc) + x86_64-unknown-linux-gnu|x86_64-apple-darwin|aarch64-apple-darwin|x86_64-pc-windows-msvc) CROSS=0 NO_STD=0 ;;