Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9d6fe3d

Browse files
committed
Auto merge of #139765 - dtolnay:hashextractif, r=ChrisDenton
[beta] Delay `hash_extract_if` stabilization from 1.87 to 1.88 This PR is a revert of: - #134655 for use in the event that we are unable to get #139764 into 1.87 (current beta).
2 parents 74f40c4 + d8fad75 commit 9d6fe3d

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

‎library/std/src/collections/hash/map.rs‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,7 @@ impl<K, V, S> HashMap<K, V, S> {
668668
/// Splitting a map into even and odd keys, reusing the original map:
669669
///
670670
/// ```
671+
/// #![feature(hash_extract_if)]
671672
/// use std::collections::HashMap;
672673
///
673674
/// let mut map: HashMap<i32, i32> = (0..8).map(|x| (x, x)).collect();
@@ -683,7 +684,7 @@ impl<K, V, S> HashMap<K, V, S> {
683684
/// ```
684685
#[inline]
685686
#[rustc_lint_query_instability]
686-
#[stable(feature = "hash_extract_if", since = "1.87.0")]
687+
#[unstable(feature = "hash_extract_if", issue = "59618")]
687688
pub fn extract_if<F>(&mut self, pred: F) -> ExtractIf<'_, K, V, F>
688689
where
689690
F: FnMut(&K, &mut V) -> bool,
@@ -1670,14 +1671,16 @@ impl<'a, K, V> Drain<'a, K, V> {
16701671
/// # Example
16711672
///
16721673
/// ```
1674+
/// #![feature(hash_extract_if)]
1675+
///
16731676
/// use std::collections::HashMap;
16741677
///
16751678
/// let mut map = HashMap::from([
16761679
/// ("a", 1),
16771680
/// ]);
16781681
/// let iter = map.extract_if(|_k, v| *v % 2 == 0);
16791682
/// ```
1680-
#[stable(feature = "hash_extract_if", since = "1.87.0")]
1683+
#[unstable(feature = "hash_extract_if", issue = "59618")]
16811684
#[must_use = "iterators are lazy and do nothing unless consumed"]
16821685
pub struct ExtractIf<'a, K, V, F>
16831686
where
@@ -2294,7 +2297,7 @@ where
22942297
}
22952298
}
22962299

2297-
#[stable(feature = "hash_extract_if", since = "1.87.0")]
2300+
#[unstable(feature = "hash_extract_if", issue = "59618")]
22982301
impl<K, V, F> Iterator for ExtractIf<'_, K, V, F>
22992302
where
23002303
F: FnMut(&K, &mut V) -> bool,
@@ -2311,10 +2314,10 @@ where
23112314
}
23122315
}
23132316

2314-
#[stable(feature = "hash_extract_if", since = "1.87.0")]
2317+
#[unstable(feature = "hash_extract_if", issue = "59618")]
23152318
impl<K, V, F> FusedIterator for ExtractIf<'_, K, V, F> where F: FnMut(&K, &mut V) -> bool {}
23162319

2317-
#[stable(feature = "hash_extract_if", since = "1.87.0")]
2320+
#[unstable(feature = "hash_extract_if", issue = "59618")]
23182321
impl<'a, K, V, F> fmt::Debug for ExtractIf<'a, K, V, F>
23192322
where
23202323
F: FnMut(&K, &mut V) -> bool,

‎library/std/src/collections/hash/set.rs‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ impl<T, S> HashSet<T, S> {
293293
/// Splitting a set into even and odd values, reusing the original set:
294294
///
295295
/// ```
296+
/// #![feature(hash_extract_if)]
296297
/// use std::collections::HashSet;
297298
///
298299
/// let mut set: HashSet<i32> = (0..8).collect();
@@ -308,7 +309,7 @@ impl<T, S> HashSet<T, S> {
308309
/// ```
309310
#[inline]
310311
#[rustc_lint_query_instability]
311-
#[stable(feature = "hash_extract_if", since = "1.87.0")]
312+
#[unstable(feature = "hash_extract_if", issue = "59618")]
312313
pub fn extract_if<F>(&mut self, pred: F) -> ExtractIf<'_, T, F>
313314
where
314315
F: FnMut(&T) -> bool,
@@ -1384,13 +1385,15 @@ pub struct Drain<'a, K: 'a> {
13841385
/// # Examples
13851386
///
13861387
/// ```
1388+
/// #![feature(hash_extract_if)]
1389+
///
13871390
/// use std::collections::HashSet;
13881391
///
13891392
/// let mut a = HashSet::from([1, 2, 3]);
13901393
///
13911394
/// let mut extract_ifed = a.extract_if(|v| v % 2 == 0);
13921395
/// ```
1393-
#[stable(feature = "hash_extract_if", since = "1.87.0")]
1396+
#[unstable(feature = "hash_extract_if", issue = "59618")]
13941397
pub struct ExtractIf<'a, K, F>
13951398
where
13961399
F: FnMut(&K) -> bool,
@@ -1673,7 +1676,7 @@ impl<K: fmt::Debug> fmt::Debug for Drain<'_, K> {
16731676
}
16741677
}
16751678

1676-
#[stable(feature = "hash_extract_if", since = "1.87.0")]
1679+
#[unstable(feature = "hash_extract_if", issue = "59618")]
16771680
impl<K, F> Iterator for ExtractIf<'_, K, F>
16781681
where
16791682
F: FnMut(&K) -> bool,
@@ -1690,10 +1693,10 @@ where
16901693
}
16911694
}
16921695

1693-
#[stable(feature = "hash_extract_if", since = "1.87.0")]
1696+
#[unstable(feature = "hash_extract_if", issue = "59618")]
16941697
impl<K, F> FusedIterator for ExtractIf<'_, K, F> where F: FnMut(&K) -> bool {}
16951698

1696-
#[stable(feature = "hash_extract_if", since = "1.87.0")]
1699+
#[unstable(feature = "hash_extract_if", issue = "59618")]
16971700
impl<'a, K, F> fmt::Debug for ExtractIf<'a, K, F>
16981701
where
16991702
F: FnMut(&K) -> bool,

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /