Skip to content

Stabilize BTree{Map,Set}::extract_if #145471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions library/alloc/src/collections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1419,7 +1419,6 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
/// # Examples
///
/// ```
/// #![feature(btree_extract_if)]
/// use std::collections::BTreeMap;
///
/// // Splitting a map into even and odd keys, reusing the original map:
Expand All @@ -1436,7 +1435,7 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
/// 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,
Expand Down Expand Up @@ -1923,7 +1922,7 @@ impl<K, V> Default for Values<'_, K, V> {
}

/// 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,
Expand Down Expand Up @@ -1956,7 +1955,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,
Expand All @@ -1968,7 +1967,7 @@ where
}
}

#[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,
Expand Down Expand Up @@ -2042,7 +2041,7 @@ impl<'a, K, V, R> ExtractIfInner<'a, K, V, R> {
}
}

#[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,
Expand Down
11 changes: 5 additions & 6 deletions library/alloc/src/collections/btree/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,6 @@ impl<T, A: Allocator + Clone> BTreeSet<T, A> {
/// # Examples
///
/// ```
/// #![feature(btree_extract_if)]
/// use std::collections::BTreeSet;
///
/// // Splitting a set into even and odd values, reusing the original set:
Expand All @@ -1219,7 +1218,7 @@ impl<T, A: Allocator + Clone> BTreeSet<T, A> {
/// 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,
Expand Down Expand Up @@ -1554,7 +1553,7 @@ impl<'a, T, A: Allocator + Clone> IntoIterator for &'a BTreeSet<T, A> {
}

/// 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,
Expand All @@ -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,
Expand All @@ -1582,7 +1581,7 @@ where
}
}

#[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,
Expand All @@ -1602,7 +1601,7 @@ where
}
}

#[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,
Expand Down
1 change: 0 additions & 1 deletion library/alloctests/benches/lib.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
1 change: 0 additions & 1 deletion library/alloctests/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#![feature(alloc_layout_extra)]
#![feature(iter_array_chunks)]
#![feature(assert_matches)]
#![feature(btree_extract_if)]
#![feature(char_max_len)]
#![feature(cow_is_borrowed)]
#![feature(core_intrinsics)]
Expand Down
1 change: 0 additions & 1 deletion src/tools/miri/tests/pass/btreemap.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
Loading