Skip to content

Add missing stability markings to BinaryHeap. #28148

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

Merged
merged 1 commit into from
Sep 2, 2015
Merged
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
31 changes: 23 additions & 8 deletions src/libcollections/binary_heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,14 @@ impl<T: Ord> BinaryHeap<T> {
/// # Examples
///
/// ```
/// #![feature(collections)]
/// #![feature(binary_heap_extras)]
///
/// use std::collections::BinaryHeap;
/// let heap = BinaryHeap::from_vec(vec![9, 1, 2, 7, 3, 2]);
/// ```
#[unstable(feature = "binary_heap_extras",
reason = "needs to be audited",
issue = "28147")]
pub fn from_vec(vec: Vec<T>) -> BinaryHeap<T> {
let mut heap = BinaryHeap { data: vec };
let mut n = heap.len() / 2;
Expand All @@ -235,7 +238,7 @@ impl<T: Ord> BinaryHeap<T> {
/// # Examples
///
/// ```
/// #![feature(collections)]
/// #![feature(binary_heap_extras)]
///
/// use std::collections::BinaryHeap;
/// let heap = BinaryHeap::from_vec(vec![1, 2, 3, 4]);
Expand Down Expand Up @@ -341,7 +344,7 @@ impl<T: Ord> BinaryHeap<T> {
/// # Examples
///
/// ```
/// #![feature(collections)]
/// #![feature(binary_heap_extras)]
///
/// use std::collections::BinaryHeap;
/// let mut heap = BinaryHeap::from_vec(vec![1, 3]);
Expand Down Expand Up @@ -388,7 +391,7 @@ impl<T: Ord> BinaryHeap<T> {
/// # Examples
///
/// ```
/// #![feature(collections)]
/// #![feature(binary_heap_extras)]
///
/// use std::collections::BinaryHeap;
/// let mut heap = BinaryHeap::new();
Expand All @@ -400,6 +403,9 @@ impl<T: Ord> BinaryHeap<T> {
/// assert_eq!(heap.len(), 2);
/// assert_eq!(heap.peek(), Some(&3));
/// ```
#[unstable(feature = "binary_heap_extras",
reason = "needs to be audited",
issue = "28147")]
pub fn push_pop(&mut self, mut item: T) -> T {
match self.data.get_mut(0) {
None => return item,
Expand All @@ -421,7 +427,7 @@ impl<T: Ord> BinaryHeap<T> {
/// # Examples
///
/// ```
/// #![feature(collections)]
/// #![feature(binary_heap_extras)]
///
/// use std::collections::BinaryHeap;
/// let mut heap = BinaryHeap::new();
Expand All @@ -431,6 +437,9 @@ impl<T: Ord> BinaryHeap<T> {
/// assert_eq!(heap.len(), 1);
/// assert_eq!(heap.peek(), Some(&3));
/// ```
#[unstable(feature = "binary_heap_extras",
reason = "needs to be audited",
issue = "28147")]
pub fn replace(&mut self, mut item: T) -> Option<T> {
if !self.is_empty() {
swap(&mut item, &mut self.data[0]);
Expand All @@ -448,7 +457,7 @@ impl<T: Ord> BinaryHeap<T> {
/// # Examples
///
/// ```
/// #![feature(collections)]
/// #![feature(binary_heap_extras)]
///
/// use std::collections::BinaryHeap;
/// let heap = BinaryHeap::from_vec(vec![1, 2, 3, 4, 5, 6, 7]);
Expand All @@ -459,6 +468,9 @@ impl<T: Ord> BinaryHeap<T> {
/// println!("{}", x);
/// }
/// ```
#[unstable(feature = "binary_heap_extras",
reason = "needs to be audited",
issue = "28147")]
pub fn into_vec(self) -> Vec<T> { self.data }

/// Consumes the `BinaryHeap` and returns a vector in sorted
Expand All @@ -467,7 +479,7 @@ impl<T: Ord> BinaryHeap<T> {
/// # Examples
///
/// ```
/// #![feature(collections)]
/// #![feature(binary_heap_extras)]
///
/// use std::collections::BinaryHeap;
///
Expand All @@ -478,6 +490,9 @@ impl<T: Ord> BinaryHeap<T> {
/// let vec = heap.into_sorted_vec();
/// assert_eq!(vec, [1, 2, 3, 4, 5, 6, 7]);
/// ```
#[unstable(feature = "binary_heap_extras",
reason = "needs to be audited",
issue = "28147")]
pub fn into_sorted_vec(mut self) -> Vec<T> {
let mut end = self.len();
while end > 1 {
Expand Down Expand Up @@ -730,7 +745,7 @@ impl<T: Ord> IntoIterator for BinaryHeap<T> {
/// # Examples
///
/// ```
/// #![feature(collections)]
/// #![feature(binary_heap_extras)]
///
/// use std::collections::BinaryHeap;
/// let heap = BinaryHeap::from_vec(vec![1, 2, 3, 4]);
Expand Down
1 change: 1 addition & 0 deletions src/libcollectionstest/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#![feature(ascii)]
#![feature(append)]
#![feature(binary_heap_extras)]
#![feature(box_syntax)]
#![feature(btree_range)]
#![feature(collections)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/binary-heap-panic-safe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(std_misc, collections, catch_panic, rand, sync_poison)]
#![feature(std_misc, binary_heap_extras, catch_panic, rand, sync_poison)]

use std::__rand::{thread_rng, Rng};
use std::thread;
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/while-let.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// except according to those terms.


#![feature(collections)]
#![feature(binary_heap_extras)]

use std::collections::BinaryHeap;

Expand Down