mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Stabilize BTree{Map,Set}::extract_if
This commit is contained in:
@@ -1433,7 +1433,6 @@ pub fn split_off<Q: ?Sized + Ord>(&mut self, key: &Q) -> Self
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(btree_extract_if)]
|
||||
/// use std::collections::BTreeMap;
|
||||
///
|
||||
/// // Splitting a map into even and odd keys, reusing the original map:
|
||||
@@ -1450,7 +1449,7 @@ pub fn split_off<Q: ?Sized + Ord>(&mut self, key: &Q) -> Self
|
||||
/// assert_eq!(low.keys().copied().collect::<Vec<_>>(), [0, 1, 2, 3]);
|
||||
/// assert_eq!(high.keys().copied().collect::<Vec<_>>(), [4, 5, 6, 7]);
|
||||
/// ```
|
||||
#[unstable(feature = "btree_extract_if", issue = "70530")]
|
||||
#[stable(feature = "btree_extract_if", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub fn extract_if<F, R>(&mut self, range: R, pred: F) -> ExtractIf<'_, K, V, R, F, A>
|
||||
where
|
||||
K: Ord,
|
||||
@@ -1937,7 +1936,7 @@ fn default() -> Self {
|
||||
}
|
||||
|
||||
/// An iterator produced by calling `extract_if` on BTreeMap.
|
||||
#[unstable(feature = "btree_extract_if", issue = "70530")]
|
||||
#[stable(feature = "btree_extract_if", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
||||
pub struct ExtractIf<
|
||||
'a,
|
||||
@@ -1970,7 +1969,7 @@ pub(super) struct ExtractIfInner<'a, K, V, R> {
|
||||
range: R,
|
||||
}
|
||||
|
||||
#[unstable(feature = "btree_extract_if", issue = "70530")]
|
||||
#[stable(feature = "btree_extract_if", since = "CURRENT_RUSTC_VERSION")]
|
||||
impl<K, V, R, F, A> fmt::Debug for ExtractIf<'_, K, V, R, F, A>
|
||||
where
|
||||
K: fmt::Debug,
|
||||
@@ -1982,7 +1981,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "btree_extract_if", issue = "70530")]
|
||||
#[stable(feature = "btree_extract_if", since = "CURRENT_RUSTC_VERSION")]
|
||||
impl<K, V, R, F, A: Allocator + Clone> Iterator for ExtractIf<'_, K, V, R, F, A>
|
||||
where
|
||||
K: PartialOrd,
|
||||
@@ -2056,7 +2055,7 @@ pub(super) fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "btree_extract_if", issue = "70530")]
|
||||
#[stable(feature = "btree_extract_if", since = "CURRENT_RUSTC_VERSION")]
|
||||
impl<K, V, R, F> FusedIterator for ExtractIf<'_, K, V, R, F>
|
||||
where
|
||||
K: PartialOrd,
|
||||
|
||||
@@ -1202,7 +1202,6 @@ pub fn split_off<Q: ?Sized + Ord>(&mut self, value: &Q) -> Self
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(btree_extract_if)]
|
||||
/// use std::collections::BTreeSet;
|
||||
///
|
||||
/// // Splitting a set into even and odd values, reusing the original set:
|
||||
@@ -1219,7 +1218,7 @@ pub fn split_off<Q: ?Sized + Ord>(&mut self, value: &Q) -> Self
|
||||
/// assert_eq!(low.into_iter().collect::<Vec<_>>(), [0, 1, 2, 3]);
|
||||
/// assert_eq!(high.into_iter().collect::<Vec<_>>(), [4, 5, 6, 7]);
|
||||
/// ```
|
||||
#[unstable(feature = "btree_extract_if", issue = "70530")]
|
||||
#[stable(feature = "btree_extract_if", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub fn extract_if<F, R>(&mut self, range: R, pred: F) -> ExtractIf<'_, T, R, F, A>
|
||||
where
|
||||
T: Ord,
|
||||
@@ -1554,7 +1553,7 @@ fn into_iter(self) -> Iter<'a, T> {
|
||||
}
|
||||
|
||||
/// An iterator produced by calling `extract_if` on BTreeSet.
|
||||
#[unstable(feature = "btree_extract_if", issue = "70530")]
|
||||
#[stable(feature = "btree_extract_if", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
||||
pub struct ExtractIf<
|
||||
'a,
|
||||
@@ -1569,7 +1568,7 @@ pub struct ExtractIf<
|
||||
alloc: A,
|
||||
}
|
||||
|
||||
#[unstable(feature = "btree_extract_if", issue = "70530")]
|
||||
#[stable(feature = "btree_extract_if", since = "CURRENT_RUSTC_VERSION")]
|
||||
impl<T, R, F, A> fmt::Debug for ExtractIf<'_, T, R, F, A>
|
||||
where
|
||||
T: fmt::Debug,
|
||||
@@ -1582,7 +1581,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "btree_extract_if", issue = "70530")]
|
||||
#[stable(feature = "btree_extract_if", since = "CURRENT_RUSTC_VERSION")]
|
||||
impl<T, R, F, A: Allocator + Clone> Iterator for ExtractIf<'_, T, R, F, A>
|
||||
where
|
||||
T: PartialOrd,
|
||||
@@ -1602,7 +1601,7 @@ fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "btree_extract_if", issue = "70530")]
|
||||
#[stable(feature = "btree_extract_if", since = "CURRENT_RUSTC_VERSION")]
|
||||
impl<T, R, F, A: Allocator + Clone> FusedIterator for ExtractIf<'_, T, R, F, A>
|
||||
where
|
||||
T: PartialOrd,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Disabling in Miri as these would take too long.
|
||||
#![cfg(not(miri))]
|
||||
#![feature(btree_extract_if)]
|
||||
#![feature(iter_next_chunk)]
|
||||
#![feature(repr_simd)]
|
||||
#![feature(slice_partition_dedup)]
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#![feature(alloc_layout_extra)]
|
||||
#![feature(iter_array_chunks)]
|
||||
#![feature(assert_matches)]
|
||||
#![feature(btree_extract_if)]
|
||||
#![feature(wtf8_internals)]
|
||||
#![feature(char_max_len)]
|
||||
#![feature(cow_is_borrowed)]
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
//@revisions: stack tree
|
||||
//@[tree]compile-flags: -Zmiri-tree-borrows
|
||||
//@compile-flags: -Zmiri-strict-provenance
|
||||
#![feature(btree_extract_if)]
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
use std::mem;
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
//@check-pass
|
||||
#![warn(unused)]
|
||||
#![feature(rustc_attrs)]
|
||||
#![feature(btree_extract_if)]
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use std::panic::{catch_unwind, AssertUnwindSafe};
|
||||
|
||||
Reference in New Issue
Block a user