Skip to content

Commit 90b63b4

Browse files
committed
Auto merge of #266 - Amanieu:fix_hash_doc, r=Amanieu
Clarify documentation of RawTable::iter_hash Fixes #263 cc `@raphaelcohn`
2 parents df668f4 + d14156f commit 90b63b4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/raw/mod.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,9 @@ impl<T, A: Allocator + Clone> RawTable<T, A> {
10461046

10471047
/// Returns an iterator over occupied buckets that could match a given hash.
10481048
///
1049-
/// In rare cases, the iterator may return a bucket with a different hash.
1049+
/// `RawTable` only stores 7 bits of the hash value, so this iterator may
1050+
/// return items that have a hash value different than the one provided. You
1051+
/// should always validate the returned values before using them.
10501052
///
10511053
/// It is up to the caller to ensure that the `RawTable` outlives the
10521054
/// `RawIterHash`. Because we cannot make the `next` method unsafe on the
@@ -2151,7 +2153,9 @@ impl<T, A: Allocator + Clone> FusedIterator for RawDrain<'_, T, A> {}
21512153

21522154
/// Iterator over occupied buckets that could match a given hash.
21532155
///
2154-
/// In rare cases, the iterator may return a bucket with a different hash.
2156+
/// `RawTable` only stores 7 bits of the hash value, so this iterator may return
2157+
/// items that have a hash value different than the one provided. You should
2158+
/// always validate the returned values before using them.
21552159
pub struct RawIterHash<'a, T, A: Allocator + Clone = Global> {
21562160
inner: RawIterHashInner<'a, A>,
21572161
_marker: PhantomData<T>,

0 commit comments

Comments
 (0)