diff options
| author | bors <bors@rust-lang.org> | 2022-02-19 12:15:10 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-02-19 12:15:10 +0000 |
| commit | e08d5693609a659e45025b8ea4dbd9efa342fa68 (patch) | |
| tree | 582c4ebf10591a5a758a3552b3e4cd7996e73974 /library/std/src/collections | |
| parent | cb4ee81ef555126e49b3e9f16ca6f12a3264a451 (diff) | |
| parent | 5a083dbbe6cbb5e7bcab3b21942d162b4628e76f (diff) | |
| download | rust-e08d5693609a659e45025b8ea4dbd9efa342fa68.tar.gz rust-e08d5693609a659e45025b8ea4dbd9efa342fa68.zip | |
Auto merge of #94148 - matthiaskrgr:rollup-jgea68f, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #92902 (Improve the documentation of drain members) - #93658 (Stabilize `#[cfg(panic = "...")]`) - #93954 (rustdoc-json: buffer output) - #93979 (Add debug assertions to validate NUL terminator in c strings) - #93990 (pre #89862 cleanup) - #94006 (Use a `Field` in `ConstraintCategory::ClosureUpvar`) - #94086 (Fix ScalarInt to char conversion) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'library/std/src/collections')
| -rw-r--r-- | library/std/src/collections/hash/map.rs | 4 | ||||
| -rw-r--r-- | library/std/src/collections/hash/set.rs | 7 |
2 files changed, 10 insertions, 1 deletions
diff --git a/library/std/src/collections/hash/map.rs b/library/std/src/collections/hash/map.rs index c7e34962abb..53b43455b5a 100644 --- a/library/std/src/collections/hash/map.rs +++ b/library/std/src/collections/hash/map.rs @@ -547,6 +547,10 @@ impl<K, V, S> HashMap<K, V, S> { /// Clears the map, returning all key-value pairs as an iterator. Keeps the /// allocated memory for reuse. /// + /// If the returned iterator is dropped before being fully consumed, it + /// drops the remaining key-value pairs. The returned iterator keeps a + /// mutable borrow on the vector to optimize its implementation. + /// /// # Examples /// /// ``` diff --git a/library/std/src/collections/hash/set.rs b/library/std/src/collections/hash/set.rs index d1450987e73..200667ae390 100644 --- a/library/std/src/collections/hash/set.rs +++ b/library/std/src/collections/hash/set.rs @@ -227,7 +227,12 @@ impl<T, S> HashSet<T, S> { self.base.is_empty() } - /// Clears the set, returning all elements in an iterator. + /// Clears the set, returning all elements as an iterator. Keeps the + /// allocated memory for reuse. + /// + /// If the returned iterator is dropped before being fully consumed, it + /// drops the remaining elements. The returned iterator keeps a mutable + /// borrow on the vector to optimize its implementation. /// /// # Examples /// |
