Skip to content

Commit 3e8bd0c

Browse files
Rollup merge of rust-lang#120485 - chenyukang:yukang-add-query-instability-check, r=michaelwoerister
add missing potential_query_instability for keys and values in hashmap From rust-lang#120435 (comment), These API are also returning iterator, so we need add `potential_query_instability` for them?
2 parents 1f82ee3 + 0e31f59 commit 3e8bd0c

File tree

1 file changed

+3
-0
lines changed
  • std/src/collections/hash

1 file changed

+3
-0
lines changed

std/src/collections/hash/map.rs

+3
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ impl<K, V, S> HashMap<K, V, S> {
356356
///
357357
/// In the current implementation, iterating over keys takes O(capacity) time
358358
/// instead of O(len) because it internally visits empty buckets too.
359+
#[rustc_lint_query_instability]
359360
#[stable(feature = "rust1", since = "1.0.0")]
360361
pub fn keys(&self) -> Keys<'_, K, V> {
361362
Keys { inner: self.iter() }
@@ -417,6 +418,7 @@ impl<K, V, S> HashMap<K, V, S> {
417418
///
418419
/// In the current implementation, iterating over values takes O(capacity) time
419420
/// instead of O(len) because it internally visits empty buckets too.
421+
#[rustc_lint_query_instability]
420422
#[stable(feature = "rust1", since = "1.0.0")]
421423
pub fn values(&self) -> Values<'_, K, V> {
422424
Values { inner: self.iter() }
@@ -449,6 +451,7 @@ impl<K, V, S> HashMap<K, V, S> {
449451
///
450452
/// In the current implementation, iterating over values takes O(capacity) time
451453
/// instead of O(len) because it internally visits empty buckets too.
454+
#[rustc_lint_query_instability]
452455
#[stable(feature = "map_values_mut", since = "1.10.0")]
453456
pub fn values_mut(&mut self) -> ValuesMut<'_, K, V> {
454457
ValuesMut { inner: self.iter_mut() }

0 commit comments

Comments
 (0)