diff --git a/library/std/src/collections/hash/map.rs b/library/std/src/collections/hash/map.rs index 0eef2bd225c06..4feebd41cc593 100644 --- a/library/std/src/collections/hash/map.rs +++ b/library/std/src/collections/hash/map.rs @@ -668,6 +668,7 @@ impl HashMap { /// Splitting a map into even and odd keys, reusing the original map: /// /// ``` + /// #![feature(hash_extract_if)] /// use std::collections::HashMap; /// /// let mut map: HashMap = (0..8).map(|x| (x, x)).collect(); @@ -683,7 +684,7 @@ impl HashMap { /// ``` #[inline] #[rustc_lint_query_instability] - #[stable(feature = "hash_extract_if", since = "1.87.0")] + #[unstable(feature = "hash_extract_if", issue = "59618")] pub fn extract_if(&mut self, pred: F) -> ExtractIf<'_, K, V, F> where F: FnMut(&K, &mut V) -> bool, @@ -1670,6 +1671,8 @@ impl<'a, K, V> Drain<'a, K, V> { /// # Example /// /// ``` +/// #![feature(hash_extract_if)] +/// /// use std::collections::HashMap; /// /// let mut map = HashMap::from([ @@ -1677,7 +1680,7 @@ impl<'a, K, V> Drain<'a, K, V> { /// ]); /// let iter = map.extract_if(|_k, v| *v % 2 == 0); /// ``` -#[stable(feature = "hash_extract_if", since = "1.87.0")] +#[unstable(feature = "hash_extract_if", issue = "59618")] #[must_use = "iterators are lazy and do nothing unless consumed"] pub struct ExtractIf<'a, K, V, F> where @@ -2294,7 +2297,7 @@ where } } -#[stable(feature = "hash_extract_if", since = "1.87.0")] +#[unstable(feature = "hash_extract_if", issue = "59618")] impl Iterator for ExtractIf<'_, K, V, F> where F: FnMut(&K, &mut V) -> bool, @@ -2311,10 +2314,10 @@ where } } -#[stable(feature = "hash_extract_if", since = "1.87.0")] +#[unstable(feature = "hash_extract_if", issue = "59618")] impl FusedIterator for ExtractIf<'_, K, V, F> where F: FnMut(&K, &mut V) -> bool {} -#[stable(feature = "hash_extract_if", since = "1.87.0")] +#[unstable(feature = "hash_extract_if", issue = "59618")] impl<'a, K, V, F> fmt::Debug for ExtractIf<'a, K, V, F> where F: FnMut(&K, &mut V) -> bool, diff --git a/library/std/src/collections/hash/set.rs b/library/std/src/collections/hash/set.rs index 7be000594bc55..c265d42d06a9f 100644 --- a/library/std/src/collections/hash/set.rs +++ b/library/std/src/collections/hash/set.rs @@ -293,6 +293,7 @@ impl HashSet { /// Splitting a set into even and odd values, reusing the original set: /// /// ``` + /// #![feature(hash_extract_if)] /// use std::collections::HashSet; /// /// let mut set: HashSet = (0..8).collect(); @@ -308,7 +309,7 @@ impl HashSet { /// ``` #[inline] #[rustc_lint_query_instability] - #[stable(feature = "hash_extract_if", since = "1.87.0")] + #[unstable(feature = "hash_extract_if", issue = "59618")] pub fn extract_if(&mut self, pred: F) -> ExtractIf<'_, T, F> where F: FnMut(&T) -> bool, @@ -1384,13 +1385,15 @@ pub struct Drain<'a, K: 'a> { /// # Examples /// /// ``` +/// #![feature(hash_extract_if)] +/// /// use std::collections::HashSet; /// /// let mut a = HashSet::from([1, 2, 3]); /// /// let mut extract_ifed = a.extract_if(|v| v % 2 == 0); /// ``` -#[stable(feature = "hash_extract_if", since = "1.87.0")] +#[unstable(feature = "hash_extract_if", issue = "59618")] pub struct ExtractIf<'a, K, F> where F: FnMut(&K) -> bool, @@ -1673,7 +1676,7 @@ impl fmt::Debug for Drain<'_, K> { } } -#[stable(feature = "hash_extract_if", since = "1.87.0")] +#[unstable(feature = "hash_extract_if", issue = "59618")] impl Iterator for ExtractIf<'_, K, F> where F: FnMut(&K) -> bool, @@ -1690,10 +1693,10 @@ where } } -#[stable(feature = "hash_extract_if", since = "1.87.0")] +#[unstable(feature = "hash_extract_if", issue = "59618")] impl FusedIterator for ExtractIf<'_, K, F> where F: FnMut(&K) -> bool {} -#[stable(feature = "hash_extract_if", since = "1.87.0")] +#[unstable(feature = "hash_extract_if", issue = "59618")] impl<'a, K, F> fmt::Debug for ExtractIf<'a, K, F> where F: FnMut(&K) -> bool,