Skip to content

Commit 4d06592

Browse files
committed
---
yaml --- r: 271411 b: refs/heads/auto c: 64adca7 h: refs/heads/master i: 271409: 2a90e31 271407: 52fa96e
1 parent c1bb9fd commit 4d06592

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
88
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
99
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1010
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
11-
refs/heads/auto: c9b3cd47e290d7831120b6a95767802265adfd08
11+
refs/heads/auto: 64adca717fe0f1fac851e9d09972adecf21bf662
1212
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1313
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336
1414
refs/tags/0.2: 1754d02027f2924bed83b0160ee340c7f41d5ea1

branches/auto/src/libstd/collections/hash/map.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,11 @@ fn robin_hood<'a, K: 'a, V: 'a>(bucket: FullBucketMut<'a, K, V>,
455455
let bucket = bucket.put(hash, key, val);
456456
// Now that it's stolen, just read the value's pointer
457457
// right out of the table! Go back to the *starting point*.
458+
//
459+
// This use of `into_table` is misleading. It turns the
460+
// bucket, which is a FullBucket on top of a
461+
// FullBucketMut, into just one FullBucketMut. The "table"
462+
// refers to the inner FullBucketMut in this context.
458463
return bucket.into_table().into_mut_refs().1;
459464
},
460465
Full(bucket) => bucket

branches/auto/src/libstd/collections/hash/table.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,9 @@ impl<K, V, M: Deref<Target=RawTable<K, V>>> FullBucket<K, V, M> {
421421
}
422422
}
423423

424-
// We don't need a `Take` trait currently. This is why a mutable reference
425-
// to the table is required.
424+
// We take a mutable reference to the table instead of accepting anything that
425+
// implements `DerefMut` to prevent fn `take` from being called on `stash`ed
426+
// buckets.
426427
impl<'t, K, V> FullBucket<K, V, &'t mut RawTable<K, V>> {
427428
/// Removes this bucket's key and value from the hashtable.
428429
///
@@ -446,6 +447,8 @@ impl<'t, K, V> FullBucket<K, V, &'t mut RawTable<K, V>> {
446447
}
447448
}
448449

450+
// This use of `Put` is misleading and restrictive, but safe and sufficient for our use cases
451+
// where `M` is a full bucket or table reference type with mutable access to the table.
449452
impl<K, V, M> FullBucket<K, V, M> where M: Put<K, V> {
450453
pub fn replace(&mut self, h: SafeHash, k: K, v: V) -> (SafeHash, K, V) {
451454
unsafe {

0 commit comments

Comments
 (0)