Skip to content
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

std: Remove deprecated functionality from 1.5 #30182

Merged
merged 1 commit into from
Dec 10, 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
7 changes: 0 additions & 7 deletions src/liballoc/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,13 +385,6 @@ impl<T: ?Sized> Deref for Arc<T> {
}

impl<T: Clone> Arc<T> {
#[unstable(feature = "arc_make_unique", reason = "renamed to Arc::make_mut",
issue = "27718")]
#[rustc_deprecated(since = "1.4.0", reason = "renamed to Arc::make_mut")]
pub fn make_unique(this: &mut Self) -> &mut T {
Arc::make_mut(this)
}

/// Make a mutable reference into the given `Arc<T>` by cloning the inner
/// data if the `Arc<T>` doesn't have one strong reference and no weak
/// references.
Expand Down
8 changes: 0 additions & 8 deletions src/liballoc/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,14 +360,6 @@ impl<T: ?Sized> Rc<T> {
}

impl<T: Clone> Rc<T> {
#[inline]
#[unstable(feature = "rc_make_unique", reason = "renamed to Rc::make_mut",
issue = "27718")]
#[rustc_deprecated(since = "1.4.0", reason = "renamed to Rc::make_mut")]
pub fn make_unique(&mut self) -> &mut T {
Rc::make_mut(self)
}

/// Make a mutable reference into the given `Rc<T>` by cloning the inner
/// data if the `Rc<T>` doesn't have one strong reference and no weak
/// references.
Expand Down
20 changes: 0 additions & 20 deletions src/libcollections/binary_heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,26 +230,6 @@ impl<T: Ord> BinaryHeap<T> {
BinaryHeap { data: Vec::with_capacity(capacity) }
}

/// Creates a `BinaryHeap` from a vector. This is sometimes called
/// `heapifying` the vector.
///
/// # Examples
///
/// ```
/// #![feature(binary_heap_extras)]
/// # #![allow(deprecated)]
///
/// 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")]
#[rustc_deprecated(since = "1.5.0", reason = "use BinaryHeap::from instead")]
pub fn from_vec(vec: Vec<T>) -> BinaryHeap<T> {
BinaryHeap::from(vec)
}

/// Returns an iterator visiting all values in the underlying vector, in
/// arbitrary order.
///
Expand Down
23 changes: 5 additions & 18 deletions src/libcollections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,25 +151,14 @@ impl<K: Ord, V> BTreeMap<K, V> {
#[stable(feature = "rust1", since = "1.0.0")]
#[allow(deprecated)]
pub fn new() -> BTreeMap<K, V> {
// FIXME(Gankro): Tune this as a function of size_of<K/V>?
BTreeMap::with_b(6)
}

/// Makes a new empty BTreeMap with the given B.
///
/// B cannot be less than 2.
#[unstable(feature = "btree_b",
reason = "probably want this to be on the type, eventually",
issue = "27795")]
#[rustc_deprecated(since = "1.4.0", reason = "niche API")]
pub fn with_b(b: usize) -> BTreeMap<K, V> {
assert!(b > 1, "B must be greater than 1");
BTreeMap {
length: 0,
depth: 1,
root: Node::make_leaf_root(b),
b: b,
root: Node::make_leaf_root(6),
// FIXME(Gankro): Tune this as a function of size_of<K/V>?
b: 6,
}

}

/// Clears the map, removing all values.
Expand All @@ -185,11 +174,9 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// assert!(a.is_empty());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[allow(deprecated)]
pub fn clear(&mut self) {
let b = self.b;
// avoid recursive destructors by manually traversing the tree
for _ in mem::replace(self, BTreeMap::with_b(b)) {}
for _ in mem::replace(self, BTreeMap::new()) {}
}

// Searching in a B-Tree is pretty straightforward.
Expand Down
12 changes: 0 additions & 12 deletions src/libcollections/btree/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,6 @@ impl<T: Ord> BTreeSet<T> {
pub fn new() -> BTreeSet<T> {
BTreeSet { map: BTreeMap::new() }
}

/// Makes a new BTreeSet with the given B.
///
/// B cannot be less than 2.
#[unstable(feature = "btree_b",
reason = "probably want this to be on the type, eventually",
issue = "27795")]
#[rustc_deprecated(since = "1.4.0", reason = "niche API")]
#[allow(deprecated)]
pub fn with_b(b: usize) -> BTreeSet<T> {
BTreeSet { map: BTreeMap::with_b(b) }
}
}

impl<T> BTreeSet<T> {
Expand Down
3 changes: 0 additions & 3 deletions src/libcollections/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@ pub use core::slice::{Iter, IterMut};
pub use core::slice::{SplitMut, ChunksMut, Split};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::slice::{SplitN, RSplitN, SplitNMut, RSplitNMut};
#[unstable(feature = "ref_slice", issue = "27774")]
#[allow(deprecated)]
pub use core::slice::{bytes, mut_ref_slice, ref_slice};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::slice::{from_raw_parts, from_raw_parts_mut};

Expand Down
11 changes: 0 additions & 11 deletions src/libcollections/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1074,17 +1074,6 @@ impl String {
let slice = self.vec.into_boxed_slice();
unsafe { mem::transmute::<Box<[u8]>, Box<str>>(slice) }
}

/// Converts the string into `Box<str>`.
///
/// Note that this will drop any excess capacity.
#[unstable(feature = "box_str2",
reason = "recently added, matches RFC",
issue = "27785")]
#[rustc_deprecated(since = "1.4.0", reason = "renamed to `into_boxed_str`")]
pub fn into_boxed_slice(self) -> Box<str> {
self.into_boxed_str()
}
}

impl FromUtf8Error {
Expand Down
22 changes: 2 additions & 20 deletions src/libcollections/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1115,15 +1115,6 @@ impl<T> VecDeque<T> {
self.pop_back()
}

/// deprecated
#[unstable(feature = "deque_extras",
reason = "the naming of this function may be altered",
issue = "27788")]
#[rustc_deprecated(since = "1.5.0", reason = "renamed to swap_remove_back")]
pub fn swap_back_remove(&mut self, index: usize) -> Option<T> {
self.swap_remove_back(index)
}

/// Removes an element from anywhere in the `VecDeque` and returns it,
/// replacing it with the first element.
///
Expand Down Expand Up @@ -1158,15 +1149,6 @@ impl<T> VecDeque<T> {
self.pop_front()
}

/// deprecated
#[unstable(feature = "deque_extras",
reason = "the naming of this function may be altered",
issue = "27788")]
#[rustc_deprecated(since = "1.5.0", reason = "renamed to swap_remove_front")]
pub fn swap_front_remove(&mut self, index: usize) -> Option<T> {
self.swap_remove_front(index)
}

/// Inserts an element at `index` within the `VecDeque`. Whichever
/// end is closer to the insertion point will be moved to make room,
/// and all the affected elements will be moved to new positions.
Expand Down Expand Up @@ -2178,15 +2160,15 @@ mod tests {
tester.push_front(i);
}
for i in 0..len {
assert_eq!(tester.swap_back_remove(i), Some(len * 2 - 1 - i));
assert_eq!(tester.swap_remove_back(i), Some(len * 2 - 1 - i));
}
} else {
for i in 0..len * 2 {
tester.push_back(i);
}
for i in 0..len {
let idx = tester.len() - 1 - i;
assert_eq!(tester.swap_front_remove(idx), Some(len * 2 - 1 - i));
assert_eq!(tester.swap_remove_front(idx), Some(len * 2 - 1 - i));
}
}
assert!(tester.tail < tester.cap());
Expand Down
22 changes: 11 additions & 11 deletions src/libcollectionstest/binary_heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use std::collections::BinaryHeap;
fn test_iterator() {
let data = vec![5, 9, 3];
let iterout = [9, 5, 3];
let heap = BinaryHeap::from_vec(data);
let heap = BinaryHeap::from(data);
let mut i = 0;
for el in &heap {
assert_eq!(*el, iterout[i]);
Expand All @@ -26,7 +26,7 @@ fn test_iterator() {
fn test_iterator_reverse() {
let data = vec![5, 9, 3];
let iterout = vec![3, 5, 9];
let pq = BinaryHeap::from_vec(data);
let pq = BinaryHeap::from(data);

let v: Vec<_> = pq.iter().rev().cloned().collect();
assert_eq!(v, iterout);
Expand All @@ -36,7 +36,7 @@ fn test_iterator_reverse() {
fn test_move_iter() {
let data = vec![5, 9, 3];
let iterout = vec![9, 5, 3];
let pq = BinaryHeap::from_vec(data);
let pq = BinaryHeap::from(data);

let v: Vec<_> = pq.into_iter().collect();
assert_eq!(v, iterout);
Expand All @@ -45,7 +45,7 @@ fn test_move_iter() {
#[test]
fn test_move_iter_size_hint() {
let data = vec![5, 9];
let pq = BinaryHeap::from_vec(data);
let pq = BinaryHeap::from(data);

let mut it = pq.into_iter();

Expand All @@ -63,7 +63,7 @@ fn test_move_iter_size_hint() {
fn test_move_iter_reverse() {
let data = vec![5, 9, 3];
let iterout = vec![3, 5, 9];
let pq = BinaryHeap::from_vec(data);
let pq = BinaryHeap::from(data);

let v: Vec<_> = pq.into_iter().rev().collect();
assert_eq!(v, iterout);
Expand All @@ -74,7 +74,7 @@ fn test_peek_and_pop() {
let data = vec![2, 4, 6, 2, 1, 8, 10, 3, 5, 7, 0, 9, 1];
let mut sorted = data.clone();
sorted.sort();
let mut heap = BinaryHeap::from_vec(data);
let mut heap = BinaryHeap::from(data);
while !heap.is_empty() {
assert_eq!(heap.peek().unwrap(), sorted.last().unwrap());
assert_eq!(heap.pop().unwrap(), sorted.pop().unwrap());
Expand All @@ -83,7 +83,7 @@ fn test_peek_and_pop() {

#[test]
fn test_push() {
let mut heap = BinaryHeap::from_vec(vec![2, 4, 9]);
let mut heap = BinaryHeap::from(vec![2, 4, 9]);
assert_eq!(heap.len(), 3);
assert!(*heap.peek().unwrap() == 9);
heap.push(11);
Expand All @@ -105,7 +105,7 @@ fn test_push() {

#[test]
fn test_push_unique() {
let mut heap = BinaryHeap::<Box<_>>::from_vec(vec![box 2, box 4, box 9]);
let mut heap = BinaryHeap::<Box<_>>::from(vec![box 2, box 4, box 9]);
assert_eq!(heap.len(), 3);
assert!(*heap.peek().unwrap() == box 9);
heap.push(box 11);
Expand All @@ -127,7 +127,7 @@ fn test_push_unique() {

#[test]
fn test_push_pop() {
let mut heap = BinaryHeap::from_vec(vec![5, 5, 2, 1, 3]);
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);
Expand All @@ -141,7 +141,7 @@ fn test_push_pop() {

#[test]
fn test_replace() {
let mut heap = BinaryHeap::from_vec(vec![5, 5, 2, 1, 3]);
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);
Expand All @@ -154,7 +154,7 @@ fn test_replace() {
}

fn check_to_vec(mut data: Vec<i32>) {
let heap = BinaryHeap::from_vec(data.clone());
let heap = BinaryHeap::from(data.clone());
let mut v = heap.clone().into_vec();
v.sort();
data.sort();
Expand Down
3 changes: 1 addition & 2 deletions src/libcollectionstest/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use std::collections::BTreeMap;
use std::collections::Bound::{Excluded, Included, Unbounded, self};
use std::collections::btree_map::Entry::{Occupied, Vacant};
use std::iter::range_inclusive;
use std::rc::Rc;

#[test]
Expand Down Expand Up @@ -188,7 +187,7 @@ fn test_range() {
for i in 0..size {
for j in i..size {
let mut kvs = map.range(Included(&i), Included(&j)).map(|(&k, &v)| (k, v));
let mut pairs = range_inclusive(i, j).map(|i| (i, i));
let mut pairs = (i..j+1).map(|i| (i, i));

for (kv, pair) in kvs.by_ref().zip(pairs.by_ref()) {
assert_eq!(kv, pair);
Expand Down
11 changes: 0 additions & 11 deletions src/libcollectionstest/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -866,17 +866,6 @@ fn test_vec_default() {
t!(Vec<i32>);
}

#[test]
fn test_bytes_set_memory() {
use std::slice::bytes::MutableByteVector;

let mut values = [1,2,3,4,5];
values[0..5].set_memory(0xAB);
assert!(values == [0xAB, 0xAB, 0xAB, 0xAB, 0xAB]);
values[2..4].set_memory(0xFF);
assert!(values == [0xAB, 0xAB, 0xFF, 0xFF, 0xAB]);
}

#[test]
#[should_panic]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how come this was removed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh I thought I removed the trait, but I think we actually just deprecated the trait so I got mixed up.

fn test_overflow_does_not_cause_segfault() {
Expand Down
Loading