Skip to content

Commit

Permalink
Stabilize vecdeque_binary_search
Browse files Browse the repository at this point in the history
  • Loading branch information
SOF3 authored and m-ou-se committed Jun 2, 2021
1 parent 7f9ab03 commit f7c283c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
10 changes: 3 additions & 7 deletions library/alloc/src/collections/vec_deque/mod.rs
Expand Up @@ -2416,7 +2416,6 @@ impl<T> VecDeque<T> {
/// found; the fourth could match any position in `[1, 4]`.
///
/// ```
/// #![feature(vecdeque_binary_search)]
/// use std::collections::VecDeque;
///
/// let deque: VecDeque<_> = vec![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55].into();
Expand All @@ -2432,7 +2431,6 @@ impl<T> VecDeque<T> {
/// sort order:
///
/// ```
/// #![feature(vecdeque_binary_search)]
/// use std::collections::VecDeque;
///
/// let mut deque: VecDeque<_> = vec![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55].into();
Expand All @@ -2441,7 +2439,7 @@ impl<T> VecDeque<T> {
/// deque.insert(idx, num);
/// assert_eq!(deque, &[0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]);
/// ```
#[unstable(feature = "vecdeque_binary_search", issue = "78021")]
#[stable(feature = "vecdeque_binary_search", since = "1.52.0")]
#[inline]
pub fn binary_search(&self, x: &T) -> Result<usize, usize>
where
Expand Down Expand Up @@ -2476,7 +2474,6 @@ impl<T> VecDeque<T> {
/// found; the fourth could match any position in `[1, 4]`.
///
/// ```
/// #![feature(vecdeque_binary_search)]
/// use std::collections::VecDeque;
///
/// let deque: VecDeque<_> = vec![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55].into();
Expand All @@ -2487,7 +2484,7 @@ impl<T> VecDeque<T> {
/// let r = deque.binary_search_by(|x| x.cmp(&1));
/// assert!(matches!(r, Ok(1..=4)));
/// ```
#[unstable(feature = "vecdeque_binary_search", issue = "78021")]
#[stable(feature = "vecdeque_binary_search", since = "1.52.0")]
pub fn binary_search_by<'a, F>(&'a self, mut f: F) -> Result<usize, usize>
where
F: FnMut(&'a T) -> Ordering,
Expand Down Expand Up @@ -2530,7 +2527,6 @@ impl<T> VecDeque<T> {
/// fourth could match any position in `[1, 4]`.
///
/// ```
/// #![feature(vecdeque_binary_search)]
/// use std::collections::VecDeque;
///
/// let deque: VecDeque<_> = vec![(0, 0), (2, 1), (4, 1), (5, 1),
Expand All @@ -2543,7 +2539,7 @@ impl<T> VecDeque<T> {
/// let r = deque.binary_search_by_key(&1, |&(a, b)| b);
/// assert!(matches!(r, Ok(1..=4)));
/// ```
#[unstable(feature = "vecdeque_binary_search", issue = "78021")]
#[stable(feature = "vecdeque_binary_search", since = "1.52.0")]
#[inline]
pub fn binary_search_by_key<'a, B, F>(&'a self, b: &B, mut f: F) -> Result<usize, usize>
where
Expand Down
1 change: 0 additions & 1 deletion library/alloc/tests/lib.rs
Expand Up @@ -17,7 +17,6 @@
#![feature(binary_heap_as_slice)]
#![feature(inplace_iteration)]
#![feature(iter_map_while)]
#![feature(vecdeque_binary_search)]
#![feature(slice_group_by)]
#![feature(slice_partition_dedup)]
#![feature(vec_spare_capacity)]
Expand Down

0 comments on commit f7c283c

Please sign in to comment.