Skip to content

Commit 9a06f65

Browse files
authored
Rollup merge of #83362 - SOF3:stab/vecdeque-binary-search, r=m-ou-se
Stabilize `vecdeque_binary_search` This PR stabilizes the feature `vecdeque_binary_search` as tracked in #78021. The tracking issue has not received any comments for the past 5 months, and concerns have been raised neither in the RFC rust-lang/rfcs#2997 nor in the tracking issue #78021.
2 parents 19579c6 + f717992 commit 9a06f65

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

library/alloc/src/collections/vec_deque/mod.rs

+4-9
Original file line numberDiff line numberDiff line change
@@ -2416,7 +2416,6 @@ impl<T> VecDeque<T> {
24162416
/// found; the fourth could match any position in `[1, 4]`.
24172417
///
24182418
/// ```
2419-
/// #![feature(vecdeque_binary_search)]
24202419
/// use std::collections::VecDeque;
24212420
///
24222421
/// let deque: VecDeque<_> = vec![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55].into();
@@ -2432,7 +2431,6 @@ impl<T> VecDeque<T> {
24322431
/// sort order:
24332432
///
24342433
/// ```
2435-
/// #![feature(vecdeque_binary_search)]
24362434
/// use std::collections::VecDeque;
24372435
///
24382436
/// let mut deque: VecDeque<_> = vec![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55].into();
@@ -2441,7 +2439,7 @@ impl<T> VecDeque<T> {
24412439
/// deque.insert(idx, num);
24422440
/// assert_eq!(deque, &[0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]);
24432441
/// ```
2444-
#[unstable(feature = "vecdeque_binary_search", issue = "78021")]
2442+
#[stable(feature = "vecdeque_binary_search", since = "1.54.0")]
24452443
#[inline]
24462444
pub fn binary_search(&self, x: &T) -> Result<usize, usize>
24472445
where
@@ -2476,7 +2474,6 @@ impl<T> VecDeque<T> {
24762474
/// found; the fourth could match any position in `[1, 4]`.
24772475
///
24782476
/// ```
2479-
/// #![feature(vecdeque_binary_search)]
24802477
/// use std::collections::VecDeque;
24812478
///
24822479
/// let deque: VecDeque<_> = vec![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55].into();
@@ -2487,7 +2484,7 @@ impl<T> VecDeque<T> {
24872484
/// let r = deque.binary_search_by(|x| x.cmp(&1));
24882485
/// assert!(matches!(r, Ok(1..=4)));
24892486
/// ```
2490-
#[unstable(feature = "vecdeque_binary_search", issue = "78021")]
2487+
#[stable(feature = "vecdeque_binary_search", since = "1.54.0")]
24912488
pub fn binary_search_by<'a, F>(&'a self, mut f: F) -> Result<usize, usize>
24922489
where
24932490
F: FnMut(&'a T) -> Ordering,
@@ -2530,7 +2527,6 @@ impl<T> VecDeque<T> {
25302527
/// fourth could match any position in `[1, 4]`.
25312528
///
25322529
/// ```
2533-
/// #![feature(vecdeque_binary_search)]
25342530
/// use std::collections::VecDeque;
25352531
///
25362532
/// let deque: VecDeque<_> = vec![(0, 0), (2, 1), (4, 1), (5, 1),
@@ -2543,7 +2539,7 @@ impl<T> VecDeque<T> {
25432539
/// let r = deque.binary_search_by_key(&1, |&(a, b)| b);
25442540
/// assert!(matches!(r, Ok(1..=4)));
25452541
/// ```
2546-
#[unstable(feature = "vecdeque_binary_search", issue = "78021")]
2542+
#[stable(feature = "vecdeque_binary_search", since = "1.54.0")]
25472543
#[inline]
25482544
pub fn binary_search_by_key<'a, B, F>(&'a self, b: &B, mut f: F) -> Result<usize, usize>
25492545
where
@@ -2574,7 +2570,6 @@ impl<T> VecDeque<T> {
25742570
/// # Examples
25752571
///
25762572
/// ```
2577-
/// #![feature(vecdeque_binary_search)]
25782573
/// use std::collections::VecDeque;
25792574
///
25802575
/// let deque: VecDeque<_> = vec![1, 2, 3, 3, 5, 6, 7].into();
@@ -2584,7 +2579,7 @@ impl<T> VecDeque<T> {
25842579
/// assert!(deque.iter().take(i).all(|&x| x < 5));
25852580
/// assert!(deque.iter().skip(i).all(|&x| !(x < 5)));
25862581
/// ```
2587-
#[unstable(feature = "vecdeque_binary_search", issue = "78021")]
2582+
#[stable(feature = "vecdeque_binary_search", since = "1.54.0")]
25882583
pub fn partition_point<P>(&self, mut pred: P) -> usize
25892584
where
25902585
P: FnMut(&T) -> bool,

library/alloc/tests/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#![feature(binary_heap_as_slice)]
1818
#![feature(inplace_iteration)]
1919
#![feature(iter_map_while)]
20-
#![feature(vecdeque_binary_search)]
2120
#![feature(slice_group_by)]
2221
#![feature(slice_partition_dedup)]
2322
#![feature(vec_spare_capacity)]

0 commit comments

Comments
 (0)