From 77940bb33bda19008e16aa5bbbf12d6196265ee9 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Fri, 3 May 2024 20:09:52 +0000 Subject: [PATCH] =?UTF-8?q?Bug=201894792=20-=20build:=20upgrade=20`hashbro?= =?UTF-8?q?wn`=200.14.3=20=E2=86=92=200.14.5=20r=3Dsupply-chain-reviewers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Differential Revision: https://phabricator.services.mozilla.com/D209286 --- Cargo.lock | 10 ++--- supply-chain/imports.lock | 7 ++++ .../rust/hashbrown/.cargo-checksum.json | 2 +- third_party/rust/hashbrown/CHANGELOG.md | 18 +++++++- third_party/rust/hashbrown/Cargo.toml | 4 +- third_party/rust/hashbrown/src/lib.rs | 1 + third_party/rust/hashbrown/src/map.rs | 8 ++-- third_party/rust/hashbrown/src/raw/mod.rs | 39 ++++++++---------- third_party/rust/hashbrown/src/set.rs | 41 ++++++++++--------- third_party/rust/hashbrown/src/table.rs | 6 +++ 10 files changed, 81 insertions(+), 55 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index afdf1cdb776e..d385acc168a8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2546,7 +2546,7 @@ source = "git+https://github.com/zakarumych/gpu-descriptor?rev=7b71a4e47c81903ad dependencies = [ "bitflags 2.5.0", "gpu-descriptor-types", - "hashbrown 0.14.3", + "hashbrown 0.14.5", ] [[package]] @@ -2604,14 +2604,14 @@ checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" name = "hashbrown" version = "0.12.999" dependencies = [ - "hashbrown 0.14.3", + "hashbrown 0.14.5", ] [[package]] name = "hashbrown" -version = "0.14.3" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", ] @@ -2947,7 +2947,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", - "hashbrown 0.14.3", + "hashbrown 0.14.5", "serde", ] diff --git a/supply-chain/imports.lock b/supply-chain/imports.lock index 9eda3a82ff2b..1c74996183ab 100644 --- a/supply-chain/imports.lock +++ b/supply-chain/imports.lock @@ -281,6 +281,13 @@ user-id = 2915 user-login = "Amanieu" user-name = "Amanieu d'Antras" +[[publisher.hashbrown]] +version = "0.14.5" +when = "2024-04-28" +user-id = 2915 +user-login = "Amanieu" +user-name = "Amanieu d'Antras" + [[publisher.headers]] version = "0.3.9" when = "2023-08-31" diff --git a/third_party/rust/hashbrown/.cargo-checksum.json b/third_party/rust/hashbrown/.cargo-checksum.json index 4b77da6ba699..0c5744048e8f 100644 --- a/third_party/rust/hashbrown/.cargo-checksum.json +++ b/third_party/rust/hashbrown/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"f93d5061aa77fe578b130b84ffddb1d9f53dac45a8db5dd8edfc2fad7a3b8bca","Cargo.toml":"e8848d9e1cc46174ce8e51c40fdfb9f414a2cbb92f99a342b013b9165f897150","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"ff8f68cb076caf8cefe7a6430d4ac086ce6af2ca8ce2c4e5a2004d4552ef52a2","README.md":"84c222ce49510535419d338b7532a72a2bf22b7466e44de78d92d25b6c7d636b","benches/bench.rs":"ef7bc025922f077d307c565640c005d056e3d6c1713448a95aae92d3c22c1005","benches/insert_unique_unchecked.rs":"cb84275f22d5f95a5ac995ac6b2df74ffcf342765b401d27c95f2955c7b7cb9f","clippy.toml":"7535949f908c6d9aea4f9a9f3a7625552c93fc29e963d059d40f4def9d77ea7b","src/external_trait_impls/mod.rs":"0625e6a5e3b8ecc8901a12aeeea54393fd84617fb3a14d98a34d2d2bddb8d257","src/external_trait_impls/rayon/helpers.rs":"ba105bf0853ebc45157f22116ad0f55d3bdab75e721d8e7a677c7b912d0c0c6d","src/external_trait_impls/rayon/map.rs":"96fdf39b3f601f77152d7ce84541b8f51f32b9274b7da9c294862892e721a5d8","src/external_trait_impls/rayon/mod.rs":"126edc882501dddd25e442d9236508b5b386eb8c0a9f5d654f2dd081086c1616","src/external_trait_impls/rayon/raw.rs":"04012fb2e99648819b4bc0044107ed3cb94013e242b7865075c5bd9ebf1b6865","src/external_trait_impls/rayon/set.rs":"7539348ff7bc6e3cce6b3c019d62dc401eea0138c578fef729c2593e8ead1cfa","src/external_trait_impls/rayon/table.rs":"8778d29509c68b5b7cb66859db025d3939ce22e7cf370b20ff3dea4fe4b29fd0","src/external_trait_impls/rkyv/hash_map.rs":"7abe24318143b776016052b05840656afc858b1ba5252f3d418d61972477f53d","src/external_trait_impls/rkyv/hash_set.rs":"38d969125d17d606492ec4ec9fc06b7e7118eb903240dacf40de21b9b06fa5c8","src/external_trait_impls/rkyv/mod.rs":"54399ce5574fd1d84b7b0cb4238fa3e898575e89a6724299be009d2172bda02e","src/external_trait_impls/serde.rs":"6dbe104dee16b453b6b048b541c6e02c6d067d970dfafd243fc4360288b0168c","src/lib.rs":"fbc05970d6458046590e9c4a33fc9a6fdc94ef725b9b00354fa609e207e6ae50","src/macros.rs":"98a26b908fc0fbe6a58d008a317e550013d615eb3cc17a5054a573c62c1d74cb","src/map.rs":"f1280987ac23fa387c4378666c8e0a971723b3935b5d76d6b17f1f707a20c30a","src/raw/alloc.rs":"902f8588d0fdee3e5c3dc02410f41d4b38ac88843727387f929f3186b3a2d322","src/raw/bitmask.rs":"3b3dce8d6a48856ada19085abf43908f124ab3419fcf434b9ca64d7bff243f67","src/raw/generic.rs":"efc5e603be3e9a17935aef1836a38ce01c78a0093b2af0671548eb5459b37921","src/raw/mod.rs":"42dc33a975e00fa4d984cc00d33915412b5c0a80341e38b53ad46a44f65170ad","src/raw/neon.rs":"9907d8ebc36fc3df562dde478ea9b72213fda65288a304718d8647f0029dc9ad","src/raw/sse2.rs":"39038e3344e49f4638e211bcdbf56565ac53e90dce56172cc3b526fea911c2af","src/rustc_entry.rs":"8142ed89b50155602ef8c1628382bd62d3ee903920fe49d403d4100a278c6ba4","src/scopeguard.rs":"1a246e08a63c06cd8ad934bd7da229421bf804f991ae93cd7e242da27ca6c601","src/set.rs":"c23534afec96391f396904150556b149fe8500f1c0d17d70cdf10e8fa1121b45","src/table.rs":"5f5038ff39ca1680e2f5e13f9b50c7166ed41b1fa1232f7d17ff53a96c5fa8b2","tests/equivalent_trait.rs":"84faa3fe9d67c375d03fec81f0f1412c47862477d42e84e7d235258236338d5b","tests/hasher.rs":"9a8fdf67e4415618e16729969c386eefe71408cded5d46cf7b67d969276a3452","tests/raw.rs":"43ed2f98877533a0905611d9a30f26b183dd3e103e3856eeab80e7b8ac7894d3","tests/rayon.rs":"39cb24ab45fce8087bb54948715c8b6973ebfba1a325292b5b3cd9aab50b5fd2","tests/serde.rs":"6bac8054db722dd049901b37a6e006535bac30f425eb5cd91af19b5bc1dfe78e","tests/set.rs":"9f8011c29d1059aadb54b6dd4623521d5178b4278b4a56021ef2cee4bbb19fd9"},"package":"290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"} \ No newline at end of file +{"files":{"CHANGELOG.md":"1a844fe3b7466b41ca1d5914af197d5aeed7cb14f30ebe4be351367d7ca905d2","Cargo.toml":"c011f10385da722056537329f3fcf8c9b93af742e79e38885c0152a0105fc227","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"ff8f68cb076caf8cefe7a6430d4ac086ce6af2ca8ce2c4e5a2004d4552ef52a2","README.md":"84c222ce49510535419d338b7532a72a2bf22b7466e44de78d92d25b6c7d636b","benches/bench.rs":"ef7bc025922f077d307c565640c005d056e3d6c1713448a95aae92d3c22c1005","benches/insert_unique_unchecked.rs":"cb84275f22d5f95a5ac995ac6b2df74ffcf342765b401d27c95f2955c7b7cb9f","clippy.toml":"7535949f908c6d9aea4f9a9f3a7625552c93fc29e963d059d40f4def9d77ea7b","src/external_trait_impls/mod.rs":"0625e6a5e3b8ecc8901a12aeeea54393fd84617fb3a14d98a34d2d2bddb8d257","src/external_trait_impls/rayon/helpers.rs":"ba105bf0853ebc45157f22116ad0f55d3bdab75e721d8e7a677c7b912d0c0c6d","src/external_trait_impls/rayon/map.rs":"96fdf39b3f601f77152d7ce84541b8f51f32b9274b7da9c294862892e721a5d8","src/external_trait_impls/rayon/mod.rs":"126edc882501dddd25e442d9236508b5b386eb8c0a9f5d654f2dd081086c1616","src/external_trait_impls/rayon/raw.rs":"04012fb2e99648819b4bc0044107ed3cb94013e242b7865075c5bd9ebf1b6865","src/external_trait_impls/rayon/set.rs":"7539348ff7bc6e3cce6b3c019d62dc401eea0138c578fef729c2593e8ead1cfa","src/external_trait_impls/rayon/table.rs":"8778d29509c68b5b7cb66859db025d3939ce22e7cf370b20ff3dea4fe4b29fd0","src/external_trait_impls/rkyv/hash_map.rs":"7abe24318143b776016052b05840656afc858b1ba5252f3d418d61972477f53d","src/external_trait_impls/rkyv/hash_set.rs":"38d969125d17d606492ec4ec9fc06b7e7118eb903240dacf40de21b9b06fa5c8","src/external_trait_impls/rkyv/mod.rs":"54399ce5574fd1d84b7b0cb4238fa3e898575e89a6724299be009d2172bda02e","src/external_trait_impls/serde.rs":"6dbe104dee16b453b6b048b541c6e02c6d067d970dfafd243fc4360288b0168c","src/lib.rs":"74e250c18e55994a4a902eaa06aca034559d6de53501ed4bf9010fabc67e88a2","src/macros.rs":"98a26b908fc0fbe6a58d008a317e550013d615eb3cc17a5054a573c62c1d74cb","src/map.rs":"d484f2f81e5b4acf4b615f187241e34c3016aaaca53a5e71019cceb993c4ebd7","src/raw/alloc.rs":"902f8588d0fdee3e5c3dc02410f41d4b38ac88843727387f929f3186b3a2d322","src/raw/bitmask.rs":"3b3dce8d6a48856ada19085abf43908f124ab3419fcf434b9ca64d7bff243f67","src/raw/generic.rs":"efc5e603be3e9a17935aef1836a38ce01c78a0093b2af0671548eb5459b37921","src/raw/mod.rs":"16bbabf42dde9f3fb17c4f7e768aef47752d839bf624b81d24a48af3d418b3a2","src/raw/neon.rs":"9907d8ebc36fc3df562dde478ea9b72213fda65288a304718d8647f0029dc9ad","src/raw/sse2.rs":"39038e3344e49f4638e211bcdbf56565ac53e90dce56172cc3b526fea911c2af","src/rustc_entry.rs":"8142ed89b50155602ef8c1628382bd62d3ee903920fe49d403d4100a278c6ba4","src/scopeguard.rs":"1a246e08a63c06cd8ad934bd7da229421bf804f991ae93cd7e242da27ca6c601","src/set.rs":"a620ed68bd1610b76c4c1890615d71b2c04928bf5b345133a0588a065bce06fa","src/table.rs":"7b7174099d2e3cade0caeddd73e29b7395f3b9f4f1f21013f885b52cd93438cb","tests/equivalent_trait.rs":"84faa3fe9d67c375d03fec81f0f1412c47862477d42e84e7d235258236338d5b","tests/hasher.rs":"9a8fdf67e4415618e16729969c386eefe71408cded5d46cf7b67d969276a3452","tests/raw.rs":"43ed2f98877533a0905611d9a30f26b183dd3e103e3856eeab80e7b8ac7894d3","tests/rayon.rs":"39cb24ab45fce8087bb54948715c8b6973ebfba1a325292b5b3cd9aab50b5fd2","tests/serde.rs":"6bac8054db722dd049901b37a6e006535bac30f425eb5cd91af19b5bc1dfe78e","tests/set.rs":"9f8011c29d1059aadb54b6dd4623521d5178b4278b4a56021ef2cee4bbb19fd9"},"package":"e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"} \ No newline at end of file diff --git a/third_party/rust/hashbrown/CHANGELOG.md b/third_party/rust/hashbrown/CHANGELOG.md index 09011651678f..8c4068089a55 100644 --- a/third_party/rust/hashbrown/CHANGELOG.md +++ b/third_party/rust/hashbrown/CHANGELOG.md @@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/). ## [Unreleased] +### 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 @@ -471,7 +485,9 @@ 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.3...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 [v0.14.1]: https://github.com/rust-lang/hashbrown/compare/v0.14.0...v0.14.1 diff --git a/third_party/rust/hashbrown/Cargo.toml b/third_party/rust/hashbrown/Cargo.toml index ffdc0c3b3635..0a5434e49464 100644 --- a/third_party/rust/hashbrown/Cargo.toml +++ b/third_party/rust/hashbrown/Cargo.toml @@ -13,7 +13,7 @@ edition = "2021" rust-version = "1.63.0" name = "hashbrown" -version = "0.14.3" +version = "0.14.5" authors = ["Amanieu d'Antras "] exclude = [ ".github", @@ -44,7 +44,7 @@ features = [ rustdoc-args = ["--generate-link-to-definition"] [dependencies.ahash] -version = "0.8.6" +version = "0.8.7" optional = true default-features = false diff --git a/third_party/rust/hashbrown/src/lib.rs b/third_party/rust/hashbrown/src/lib.rs index 6e9592abe79c..f03ddb6ad963 100644 --- a/third_party/rust/hashbrown/src/lib.rs +++ b/third_party/rust/hashbrown/src/lib.rs @@ -37,6 +37,7 @@ #![warn(missing_docs)] #![warn(rust_2018_idioms)] #![cfg_attr(feature = "nightly", warn(fuzzy_provenance_casts))] +#![cfg_attr(feature = "nightly", allow(internal_features))] #[cfg(test)] #[macro_use] diff --git a/third_party/rust/hashbrown/src/map.rs b/third_party/rust/hashbrown/src/map.rs index 9cd768f20d08..88a826582b79 100644 --- a/third_party/rust/hashbrown/src/map.rs +++ b/third_party/rust/hashbrown/src/map.rs @@ -5,7 +5,7 @@ use crate::{Equivalent, TryReserveError}; use core::borrow::Borrow; use core::fmt::{self, Debug}; use core::hash::{BuildHasher, Hash}; -use core::iter::{FromIterator, FusedIterator}; +use core::iter::FusedIterator; use core::marker::PhantomData; use core::mem; use core::ops::Index; @@ -184,7 +184,7 @@ pub enum DefaultHashBuilder {} /// use hashbrown::HashMap; /// /// let timber_resources: HashMap<&str, i32> = [("Norway", 100), ("Denmark", 50), ("Iceland", 10)] -/// .iter().cloned().collect(); +/// .into_iter().collect(); /// // use the values stored in map /// ``` pub struct HashMap { @@ -6805,7 +6805,7 @@ mod test_map { assert_eq!(m2.len(), 2); } - thread_local! { static DROP_VECTOR: RefCell> = RefCell::new(Vec::new()) } + thread_local! { static DROP_VECTOR: RefCell> = const { RefCell::new(Vec::new()) } } #[derive(Hash, PartialEq, Eq)] struct Droppable { @@ -8524,7 +8524,7 @@ mod test_map { #[test] #[should_panic = "panic in clone"] fn test_clone_from_memory_leaks() { - use ::alloc::vec::Vec; + use alloc::vec::Vec; struct CheckedClone { panic_in_clone: bool, diff --git a/third_party/rust/hashbrown/src/raw/mod.rs b/third_party/rust/hashbrown/src/raw/mod.rs index 711fb89d070e..c8e8e29122aa 100644 --- a/third_party/rust/hashbrown/src/raw/mod.rs +++ b/third_party/rust/hashbrown/src/raw/mod.rs @@ -910,7 +910,7 @@ impl RawTable { &self.alloc } - /// Returns pointer to one past last `data` element in the the table as viewed from + /// Returns pointer to one past last `data` element in the table as viewed from /// the start point of the allocation. /// /// The caller must ensure that the `RawTable` outlives the returned [`NonNull`], @@ -919,9 +919,7 @@ impl RawTable { /// [`undefined behavior`]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html #[inline] pub fn data_end(&self) -> NonNull { - // SAFETY: `self.table.ctrl` is `NonNull`, so casting it is safe - // - // `self.table.ctrl.as_ptr().cast()` returns pointer that + // `self.table.ctrl.cast()` returns pointer that // points here (to the end of `T0`) // ∨ // [Pad], T_n, ..., T1, T0, |CT0, CT1, ..., CT_n|, CTa_0, CTa_1, ..., CTa_m @@ -938,7 +936,7 @@ impl RawTable { // // P.S. `h1(hash) & self.bucket_mask` is the same as `hash as usize % self.buckets()` because the number // of buckets is a power of two, and `self.bucket_mask = self.buckets() - 1`. - unsafe { NonNull::new_unchecked(self.table.ctrl.as_ptr().cast()) } + self.table.ctrl.cast() } /// Returns pointer to start of data table. @@ -2029,7 +2027,7 @@ impl RawTableInner { /// if this function returns an `index` it will be in the range `0..=self.buckets()`. /// /// This function does not make any changes to the `data` parts of the table, - /// or any changes to the the `items` or `growth_left` field of the table. + /// or any changes to the `items` or `growth_left` field of the table. /// /// # Safety /// @@ -2213,7 +2211,7 @@ impl RawTableInner { /// - `FULL` control bytes -> `DELETED`. /// /// This function does not make any changes to the `data` parts of the table, - /// or any changes to the the `items` or `growth_left` field of the table. + /// or any changes to the `items` or `growth_left` field of the table. /// /// # Safety /// @@ -2558,7 +2556,7 @@ impl RawTableInner { base.sub((index + 1) * size_of) } - /// Returns pointer to one past last `data` element in the the table as viewed from + /// Returns pointer to one past last `data` element in the table as viewed from /// the start point of the allocation (convenience for `self.ctrl.cast()`). /// /// This function actually returns a pointer to the end of the `data element` at @@ -2595,10 +2593,7 @@ impl RawTableInner { /// [`undefined behavior`]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html #[inline] fn data_end(&self) -> NonNull { - unsafe { - // SAFETY: `self.ctrl` is `NonNull`, so casting it is safe - NonNull::new_unchecked(self.ctrl.as_ptr().cast()) - } + self.ctrl.cast() } /// Returns an iterator-like object for a probe sequence on the table. @@ -2650,7 +2645,7 @@ impl RawTableInner { /// the end of the array. /// /// This function does not make any changes to the `data` parts of the table, - /// or any changes to the the `items` or `growth_left` field of the table. + /// or any changes to the `items` or `growth_left` field of the table. /// /// # Safety /// @@ -2684,7 +2679,7 @@ impl RawTableInner { /// bytes, returning the old control byte. /// /// This function does not make any changes to the `data` parts of the table, - /// or any changes to the the `items` or `growth_left` field of the table. + /// or any changes to the `items` or `growth_left` field of the table. /// /// # Safety /// @@ -2719,7 +2714,7 @@ impl RawTableInner { /// the end of the array. /// /// This function does not make any changes to the `data` parts of the table, - /// or any changes to the the `items` or `growth_left` field of the table. + /// or any changes to the `items` or `growth_left` field of the table. /// /// # Safety /// @@ -3587,7 +3582,7 @@ impl RawTable { // cloned so far. let mut guard = guard((0, &mut *self), |(index, self_)| { if T::NEEDS_DROP { - for i in 0..=*index { + for i in 0..*index { if self_.is_bucket_full(i) { self_.bucket(i).drop(); } @@ -3601,7 +3596,7 @@ impl RawTable { to.write(from.as_ref().clone()); // Update the index in case we need to unwind. - guard.0 = index; + guard.0 = index + 1; } // Successfully cloned all items, no need to clean up. @@ -3901,10 +3896,10 @@ impl RawIterRange { // we will never end up in the given branch, since we should have already // yielded all the elements of the table. // - // 2. For tables larger than the group width. The the number of buckets is a - // power of two (2 ^ n), Group::WIDTH is also power of two (2 ^ k). Sinse + // 2. For tables larger than the group width. The number of buckets is a + // power of two (2 ^ n), Group::WIDTH is also power of two (2 ^ k). Since // `(2 ^ n) > (2 ^ k)`, than `(2 ^ n) % (2 ^ k) = 0`. As we start from the - // the start of the array of control bytes, and never try to iterate after + // start of the array of control bytes, and never try to iterate after // getting all the elements, the last `self.current_group` will read bytes // from the `self.buckets() - Group::WIDTH` index. We know also that // `self.current_group.next()` will always retun indices within the range @@ -4224,8 +4219,8 @@ impl FullBucketsIndices { // we will never end up in the given branch, since we should have already // yielded all the elements of the table. // - // 2. For tables larger than the group width. The the number of buckets is a - // power of two (2 ^ n), Group::WIDTH is also power of two (2 ^ k). Sinse + // 2. For tables larger than the group width. The number of buckets is a + // power of two (2 ^ n), Group::WIDTH is also power of two (2 ^ k). Since // `(2 ^ n) > (2 ^ k)`, than `(2 ^ n) % (2 ^ k) = 0`. As we start from the // the start of the array of control bytes, and never try to iterate after // getting all the elements, the last `self.ctrl` will be equal to diff --git a/third_party/rust/hashbrown/src/set.rs b/third_party/rust/hashbrown/src/set.rs index fdff46d88c76..2125a7ac819d 100644 --- a/third_party/rust/hashbrown/src/set.rs +++ b/third_party/rust/hashbrown/src/set.rs @@ -4,7 +4,7 @@ use crate::{Equivalent, TryReserveError}; use alloc::borrow::ToOwned; use core::fmt; use core::hash::{BuildHasher, Hash}; -use core::iter::{Chain, FromIterator, FusedIterator}; +use core::iter::{Chain, FusedIterator}; use core::ops::{BitAnd, BitOr, BitXor, Sub}; use super::map::{self, DefaultHashBuilder, HashMap, Keys}; @@ -102,7 +102,7 @@ use crate::raw::{Allocator, Global, RawExtractIf}; /// use hashbrown::HashSet; /// /// let viking_names: HashSet<&'static str> = -/// [ "Einar", "Olaf", "Harald" ].iter().cloned().collect(); +/// [ "Einar", "Olaf", "Harald" ].into_iter().collect(); /// // use the values stored in the set /// ``` /// @@ -335,7 +335,7 @@ impl HashSet { /// ``` /// use hashbrown::HashSet; /// - /// let mut set: HashSet<_> = [1, 2, 3].iter().cloned().collect(); + /// let mut set: HashSet<_> = [1, 2, 3].into_iter().collect(); /// assert!(!set.is_empty()); /// /// // print 1, 2, 3 in an arbitrary order @@ -362,7 +362,7 @@ impl HashSet { /// use hashbrown::HashSet; /// /// let xs = [1,2,3,4,5,6]; - /// let mut set: HashSet = xs.iter().cloned().collect(); + /// let mut set: HashSet = xs.into_iter().collect(); /// set.retain(|&k| k % 2 == 0); /// assert_eq!(set.len(), 3); /// ``` @@ -724,8 +724,8 @@ where /// /// ``` /// use hashbrown::HashSet; - /// let a: HashSet<_> = [1, 2, 3].iter().cloned().collect(); - /// let b: HashSet<_> = [4, 2, 3, 4].iter().cloned().collect(); + /// let a: HashSet<_> = [1, 2, 3].into_iter().collect(); + /// let b: HashSet<_> = [4, 2, 3, 4].into_iter().collect(); /// /// // Can be seen as `a - b`. /// for x in a.difference(&b) { @@ -755,8 +755,8 @@ where /// /// ``` /// use hashbrown::HashSet; - /// let a: HashSet<_> = [1, 2, 3].iter().cloned().collect(); - /// let b: HashSet<_> = [4, 2, 3, 4].iter().cloned().collect(); + /// let a: HashSet<_> = [1, 2, 3].into_iter().collect(); + /// let b: HashSet<_> = [4, 2, 3, 4].into_iter().collect(); /// /// // Print 1, 4 in arbitrary order. /// for x in a.symmetric_difference(&b) { @@ -783,8 +783,8 @@ where /// /// ``` /// use hashbrown::HashSet; - /// let a: HashSet<_> = [1, 2, 3].iter().cloned().collect(); - /// let b: HashSet<_> = [4, 2, 3, 4].iter().cloned().collect(); + /// let a: HashSet<_> = [1, 2, 3].into_iter().collect(); + /// let b: HashSet<_> = [4, 2, 3, 4].into_iter().collect(); /// /// // Print 2, 3 in arbitrary order. /// for x in a.intersection(&b) { @@ -814,8 +814,8 @@ where /// /// ``` /// use hashbrown::HashSet; - /// let a: HashSet<_> = [1, 2, 3].iter().cloned().collect(); - /// let b: HashSet<_> = [4, 2, 3, 4].iter().cloned().collect(); + /// let a: HashSet<_> = [1, 2, 3].into_iter().collect(); + /// let b: HashSet<_> = [4, 2, 3, 4].into_iter().collect(); /// /// // Print 1, 2, 3, 4 in arbitrary order. /// for x in a.union(&b) { @@ -850,7 +850,7 @@ where /// ``` /// use hashbrown::HashSet; /// - /// let set: HashSet<_> = [1, 2, 3].iter().cloned().collect(); + /// let set: HashSet<_> = [1, 2, 3].into_iter().collect(); /// assert_eq!(set.contains(&1), true); /// assert_eq!(set.contains(&4), false); /// ``` @@ -876,7 +876,7 @@ where /// ``` /// use hashbrown::HashSet; /// - /// let set: HashSet<_> = [1, 2, 3].iter().cloned().collect(); + /// let set: HashSet<_> = [1, 2, 3].into_iter().collect(); /// assert_eq!(set.get(&2), Some(&2)); /// assert_eq!(set.get(&4), None); /// ``` @@ -903,7 +903,7 @@ where /// ``` /// use hashbrown::HashSet; /// - /// let mut set: HashSet<_> = [1, 2, 3].iter().cloned().collect(); + /// let mut set: HashSet<_> = [1, 2, 3].into_iter().collect(); /// assert_eq!(set.len(), 3); /// assert_eq!(set.get_or_insert(2), &2); /// assert_eq!(set.get_or_insert(100), &100); @@ -1034,7 +1034,7 @@ where /// ``` /// use hashbrown::HashSet; /// - /// let a: HashSet<_> = [1, 2, 3].iter().cloned().collect(); + /// let a: HashSet<_> = [1, 2, 3].into_iter().collect(); /// let mut b = HashSet::new(); /// /// assert_eq!(a.is_disjoint(&b), true); @@ -1055,7 +1055,7 @@ where /// ``` /// use hashbrown::HashSet; /// - /// let sup: HashSet<_> = [1, 2, 3].iter().cloned().collect(); + /// let sup: HashSet<_> = [1, 2, 3].into_iter().collect(); /// let mut set = HashSet::new(); /// /// assert_eq!(set.is_subset(&sup), true); @@ -1076,7 +1076,7 @@ where /// ``` /// use hashbrown::HashSet; /// - /// let sub: HashSet<_> = [1, 2].iter().cloned().collect(); + /// let sub: HashSet<_> = [1, 2].into_iter().collect(); /// let mut set = HashSet::new(); /// /// assert_eq!(set.is_superset(&sub), false); @@ -1205,7 +1205,7 @@ where /// ``` /// use hashbrown::HashSet; /// - /// let mut set: HashSet<_> = [1, 2, 3].iter().cloned().collect(); + /// let mut set: HashSet<_> = [1, 2, 3].into_iter().collect(); /// assert_eq!(set.take(&2), Some(2)); /// assert_eq!(set.take(&2), None); /// ``` @@ -2820,7 +2820,7 @@ mod test_set { assert_eq!(last_i, 49); } - for _ in &s { + if !s.is_empty() { panic!("s should be empty!"); } @@ -2834,6 +2834,7 @@ mod test_set { use core::hash; #[derive(Debug)] + #[allow(dead_code)] struct Foo(&'static str, i32); impl PartialEq for Foo { diff --git a/third_party/rust/hashbrown/src/table.rs b/third_party/rust/hashbrown/src/table.rs index a7bb5fcc94d9..faf8a6330f67 100644 --- a/third_party/rust/hashbrown/src/table.rs +++ b/third_party/rust/hashbrown/src/table.rs @@ -298,6 +298,7 @@ where /// # test() /// # } /// ``` + #[cfg_attr(feature = "inline-more", inline)] pub fn find_entry( &mut self, hash: u64, @@ -358,6 +359,7 @@ where /// # test() /// # } /// ``` + #[cfg_attr(feature = "inline-more", inline)] pub fn entry( &mut self, hash: u64, @@ -1514,6 +1516,7 @@ where /// # test() /// # } /// ``` + #[cfg_attr(feature = "inline-more", inline)] pub fn remove(self) -> (T, VacantEntry<'a, T, A>) { let (val, slot) = unsafe { self.table.raw.remove(self.bucket) }; ( @@ -1553,6 +1556,7 @@ where /// # test() /// # } /// ``` + #[inline] pub fn get(&self) -> &T { unsafe { self.bucket.as_ref() } } @@ -1606,6 +1610,7 @@ where /// # test() /// # } /// ``` + #[inline] pub fn get_mut(&mut self) -> &mut T { unsafe { self.bucket.as_mut() } } @@ -1759,6 +1764,7 @@ where /// # test() /// # } /// ``` + #[inline] pub fn insert(self, value: T) -> OccupiedEntry<'a, T, A> { let bucket = unsafe { self.table