summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2017-04-20 13:36:23 -0700
committerJosh Stone <jistone@redhat.com>2017-04-20 21:16:31 -0700
commita724ff90e744c782e425e634defbf143b8ef62b9 (patch)
tree9931fcae027926f145b784074046876d5db5fc96
parenta76274e533969c8458c4471fbfc1b84ba44137e0 (diff)
downloadrust-a724ff90e744c782e425e634defbf143b8ef62b9.tar.gz
Remove BinaryHeap::{push_pop,replace}
[unstable, deprecated since 1.13.0]
-rw-r--r--src/doc/unstable-book/src/SUMMARY.md1
-rw-r--r--src/doc/unstable-book/src/library-features/binary-heap-extras.md7
-rw-r--r--src/libcollections/binary_heap.rs76
-rw-r--r--src/libcollections/tests/binary_heap.rs37
-rw-r--r--src/libcollections/tests/lib.rs1
-rw-r--r--src/test/run-pass/while-let.rs2
6 files changed, 0 insertions, 124 deletions
diff --git a/src/doc/unstable-book/src/SUMMARY.md b/src/doc/unstable-book/src/SUMMARY.md
index b803b6556cf..4951ff7965a 100644
--- a/src/doc/unstable-book/src/SUMMARY.md
+++ b/src/doc/unstable-book/src/SUMMARY.md
@@ -103,7 +103,6 @@
- [as_c_str](library-features/as-c-str.md)
- [as_unsafe_cell](library-features/as-unsafe-cell.md)
- [ascii_ctype](library-features/ascii-ctype.md)
- - [binary_heap_extras](library-features/binary-heap-extras.md)
- [binary_heap_peek_mut_pop](library-features/binary-heap-peek-mut-pop.md)
- [borrow_state](library-features/borrow-state.md)
- [box_heap](library-features/box-heap.md)
diff --git a/src/doc/unstable-book/src/library-features/binary-heap-extras.md b/src/doc/unstable-book/src/library-features/binary-heap-extras.md
deleted file mode 100644
index aa535f3b678..00000000000
--- a/src/doc/unstable-book/src/library-features/binary-heap-extras.md
+++ /dev/null
@@ -1,7 +0,0 @@
-# `binary_heap_extras`
-
-The tracking issue for this feature is: [#28147]
-
-[#28147]: https://github.com/rust-lang/rust/issues/28147
-
-------------------------
diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs
index 149c285a72a..e61d5b31696 100644
--- a/src/libcollections/binary_heap.rs
+++ b/src/libcollections/binary_heap.rs
@@ -555,82 +555,6 @@ impl<T: Ord> BinaryHeap<T> {
self.sift_up(0, old_len);
}
- /// Pushes an item onto the binary heap, then pops the greatest item off the queue in
- /// an optimized fashion.
- ///
- /// # Examples
- ///
- /// Basic usage:
- ///
- /// ```
- /// #![feature(binary_heap_extras)]
- /// #![allow(deprecated)]
- ///
- /// use std::collections::BinaryHeap;
- /// let mut heap = BinaryHeap::new();
- /// heap.push(1);
- /// heap.push(5);
- ///
- /// assert_eq!(heap.push_pop(3), 5);
- /// assert_eq!(heap.push_pop(9), 9);
- /// assert_eq!(heap.len(), 2);
- /// assert_eq!(heap.peek(), Some(&3));
- /// ```
- #[unstable(feature = "binary_heap_extras",
- reason = "needs to be audited",
- issue = "28147")]
- #[rustc_deprecated(since = "1.13.0", reason = "use `peek_mut` instead")]
- pub fn push_pop(&mut self, mut item: T) -> T {
- match self.data.get_mut(0) {
- None => return item,
- Some(top) => {
- if *top > item {
- swap(&mut item, top);
- } else {
- return item;
- }
- }
- }
-
- self.sift_down(0);
- item
- }
-
- /// Pops the greatest item off the binary heap, then pushes an item onto the queue in
- /// an optimized fashion. The push is done regardless of whether the binary heap
- /// was empty.
- ///
- /// # Examples
- ///
- /// Basic usage:
- ///
- /// ```
- /// #![feature(binary_heap_extras)]
- /// #![allow(deprecated)]
- ///
- /// use std::collections::BinaryHeap;
- /// let mut heap = BinaryHeap::new();
- ///
- /// assert_eq!(heap.replace(1), None);
- /// assert_eq!(heap.replace(3), Some(1));
- /// assert_eq!(heap.len(), 1);
- /// assert_eq!(heap.peek(), Some(&3));
- /// ```
- #[unstable(feature = "binary_heap_extras",
- reason = "needs to be audited",
- issue = "28147")]
- #[rustc_deprecated(since = "1.13.0", reason = "use `peek_mut` instead")]
- pub fn replace(&mut self, mut item: T) -> Option<T> {
- if !self.is_empty() {
- swap(&mut item, &mut self.data[0]);
- self.sift_down(0);
- Some(item)
- } else {
- self.push(item);
- None
- }
- }
-
/// Consumes the `BinaryHeap` and returns the underlying vector
/// in arbitrary order.
///
diff --git a/src/libcollections/tests/binary_heap.rs b/src/libcollections/tests/binary_heap.rs
index d284937a9e6..af18cddaddb 100644
--- a/src/libcollections/tests/binary_heap.rs
+++ b/src/libcollections/tests/binary_heap.rs
@@ -152,36 +152,6 @@ fn test_push_unique() {
assert!(*heap.peek().unwrap() == box 103);
}
-#[test]
-#[allow(deprecated)]
-fn test_push_pop() {
- let mut heap = BinaryHeap::from(vec![5, 5, 2, 1, 3]);
- assert_eq!(heap.len(), 5);
- assert_eq!(heap.push_pop(6), 6);
- assert_eq!(heap.len(), 5);
- assert_eq!(heap.push_pop(0), 5);
- assert_eq!(heap.len(), 5);
- assert_eq!(heap.push_pop(4), 5);
- assert_eq!(heap.len(), 5);
- assert_eq!(heap.push_pop(1), 4);
- assert_eq!(heap.len(), 5);
-}
-
-#[test]
-#[allow(deprecated)]
-fn test_replace() {
- let mut heap = BinaryHeap::from(vec![5, 5, 2, 1, 3]);
- assert_eq!(heap.len(), 5);
- assert_eq!(heap.replace(6).unwrap(), 5);
- assert_eq!(heap.len(), 5);
- assert_eq!(heap.replace(0).unwrap(), 6);
- assert_eq!(heap.len(), 5);
- assert_eq!(heap.replace(4).unwrap(), 5);
- assert_eq!(heap.len(), 5);
- assert_eq!(heap.replace(1).unwrap(), 4);
- assert_eq!(heap.len(), 5);
-}
-
fn check_to_vec(mut data: Vec<i32>) {
let heap = BinaryHeap::from(data.clone());
let mut v = heap.clone().into_vec();
@@ -228,13 +198,6 @@ fn test_empty_peek_mut() {
}
#[test]
-#[allow(deprecated)]
-fn test_empty_replace() {
- let mut heap = BinaryHeap::new();
- assert!(heap.replace(5).is_none());
-}
-
-#[test]
fn test_from_iter() {
let xs = vec![9, 8, 7, 6, 5, 4, 3, 2, 1];
diff --git a/src/libcollections/tests/lib.rs b/src/libcollections/tests/lib.rs
index 618eb386c0f..9c6e31d70a5 100644
--- a/src/libcollections/tests/lib.rs
+++ b/src/libcollections/tests/lib.rs
@@ -10,7 +10,6 @@
#![deny(warnings)]
-#![feature(binary_heap_extras)]
#![feature(binary_heap_peek_mut_pop)]
#![feature(box_syntax)]
#![feature(inclusive_range_syntax)]
diff --git a/src/test/run-pass/while-let.rs b/src/test/run-pass/while-let.rs
index 9ffba2c7999..aed6986c5fe 100644
--- a/src/test/run-pass/while-let.rs
+++ b/src/test/run-pass/while-let.rs
@@ -9,8 +9,6 @@
// except according to those terms.
-#![feature(binary_heap_extras)]
-
use std::collections::BinaryHeap;
fn make_pq() -> BinaryHeap<isize> {