Skip to content

Commit 47cd3a4

Browse files
committed
Auto merge of #30182 - alexcrichton:remove-deprecated, r=aturon
This is a standard "clean out libstd" commit which removes all 1.5-and-before deprecated functionality as it's now all been deprecated for at least one entire cycle.
2 parents ce13275 + da50f7c commit 47cd3a4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+112
-1437
lines changed

src/liballoc/arc.rs

-7
Original file line numberDiff line numberDiff line change
@@ -385,13 +385,6 @@ impl<T: ?Sized> Deref for Arc<T> {
385385
}
386386

387387
impl<T: Clone> Arc<T> {
388-
#[unstable(feature = "arc_make_unique", reason = "renamed to Arc::make_mut",
389-
issue = "27718")]
390-
#[rustc_deprecated(since = "1.4.0", reason = "renamed to Arc::make_mut")]
391-
pub fn make_unique(this: &mut Self) -> &mut T {
392-
Arc::make_mut(this)
393-
}
394-
395388
/// Make a mutable reference into the given `Arc<T>` by cloning the inner
396389
/// data if the `Arc<T>` doesn't have one strong reference and no weak
397390
/// references.

src/liballoc/rc.rs

-8
Original file line numberDiff line numberDiff line change
@@ -360,14 +360,6 @@ impl<T: ?Sized> Rc<T> {
360360
}
361361

362362
impl<T: Clone> Rc<T> {
363-
#[inline]
364-
#[unstable(feature = "rc_make_unique", reason = "renamed to Rc::make_mut",
365-
issue = "27718")]
366-
#[rustc_deprecated(since = "1.4.0", reason = "renamed to Rc::make_mut")]
367-
pub fn make_unique(&mut self) -> &mut T {
368-
Rc::make_mut(self)
369-
}
370-
371363
/// Make a mutable reference into the given `Rc<T>` by cloning the inner
372364
/// data if the `Rc<T>` doesn't have one strong reference and no weak
373365
/// references.

src/libcollections/binary_heap.rs

-20
Original file line numberDiff line numberDiff line change
@@ -230,26 +230,6 @@ impl<T: Ord> BinaryHeap<T> {
230230
BinaryHeap { data: Vec::with_capacity(capacity) }
231231
}
232232

233-
/// Creates a `BinaryHeap` from a vector. This is sometimes called
234-
/// `heapifying` the vector.
235-
///
236-
/// # Examples
237-
///
238-
/// ```
239-
/// #![feature(binary_heap_extras)]
240-
/// # #![allow(deprecated)]
241-
///
242-
/// use std::collections::BinaryHeap;
243-
/// let heap = BinaryHeap::from_vec(vec![9, 1, 2, 7, 3, 2]);
244-
/// ```
245-
#[unstable(feature = "binary_heap_extras",
246-
reason = "needs to be audited",
247-
issue = "28147")]
248-
#[rustc_deprecated(since = "1.5.0", reason = "use BinaryHeap::from instead")]
249-
pub fn from_vec(vec: Vec<T>) -> BinaryHeap<T> {
250-
BinaryHeap::from(vec)
251-
}
252-
253233
/// Returns an iterator visiting all values in the underlying vector, in
254234
/// arbitrary order.
255235
///

src/libcollections/btree/map.rs

+5-18
Original file line numberDiff line numberDiff line change
@@ -151,25 +151,14 @@ impl<K: Ord, V> BTreeMap<K, V> {
151151
#[stable(feature = "rust1", since = "1.0.0")]
152152
#[allow(deprecated)]
153153
pub fn new() -> BTreeMap<K, V> {
154-
// FIXME(Gankro): Tune this as a function of size_of<K/V>?
155-
BTreeMap::with_b(6)
156-
}
157-
158-
/// Makes a new empty BTreeMap with the given B.
159-
///
160-
/// B cannot be less than 2.
161-
#[unstable(feature = "btree_b",
162-
reason = "probably want this to be on the type, eventually",
163-
issue = "27795")]
164-
#[rustc_deprecated(since = "1.4.0", reason = "niche API")]
165-
pub fn with_b(b: usize) -> BTreeMap<K, V> {
166-
assert!(b > 1, "B must be greater than 1");
167154
BTreeMap {
168155
length: 0,
169156
depth: 1,
170-
root: Node::make_leaf_root(b),
171-
b: b,
157+
root: Node::make_leaf_root(6),
158+
// FIXME(Gankro): Tune this as a function of size_of<K/V>?
159+
b: 6,
172160
}
161+
173162
}
174163

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

195182
// Searching in a B-Tree is pretty straightforward.

src/libcollections/btree/set.rs

-12
Original file line numberDiff line numberDiff line change
@@ -98,18 +98,6 @@ impl<T: Ord> BTreeSet<T> {
9898
pub fn new() -> BTreeSet<T> {
9999
BTreeSet { map: BTreeMap::new() }
100100
}
101-
102-
/// Makes a new BTreeSet with the given B.
103-
///
104-
/// B cannot be less than 2.
105-
#[unstable(feature = "btree_b",
106-
reason = "probably want this to be on the type, eventually",
107-
issue = "27795")]
108-
#[rustc_deprecated(since = "1.4.0", reason = "niche API")]
109-
#[allow(deprecated)]
110-
pub fn with_b(b: usize) -> BTreeSet<T> {
111-
BTreeSet { map: BTreeMap::with_b(b) }
112-
}
113101
}
114102

115103
impl<T> BTreeSet<T> {

src/libcollections/slice.rs

-3
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,6 @@ pub use core::slice::{Iter, IterMut};
110110
pub use core::slice::{SplitMut, ChunksMut, Split};
111111
#[stable(feature = "rust1", since = "1.0.0")]
112112
pub use core::slice::{SplitN, RSplitN, SplitNMut, RSplitNMut};
113-
#[unstable(feature = "ref_slice", issue = "27774")]
114-
#[allow(deprecated)]
115-
pub use core::slice::{bytes, mut_ref_slice, ref_slice};
116113
#[stable(feature = "rust1", since = "1.0.0")]
117114
pub use core::slice::{from_raw_parts, from_raw_parts_mut};
118115

src/libcollections/string.rs

-11
Original file line numberDiff line numberDiff line change
@@ -1074,17 +1074,6 @@ impl String {
10741074
let slice = self.vec.into_boxed_slice();
10751075
unsafe { mem::transmute::<Box<[u8]>, Box<str>>(slice) }
10761076
}
1077-
1078-
/// Converts the string into `Box<str>`.
1079-
///
1080-
/// Note that this will drop any excess capacity.
1081-
#[unstable(feature = "box_str2",
1082-
reason = "recently added, matches RFC",
1083-
issue = "27785")]
1084-
#[rustc_deprecated(since = "1.4.0", reason = "renamed to `into_boxed_str`")]
1085-
pub fn into_boxed_slice(self) -> Box<str> {
1086-
self.into_boxed_str()
1087-
}
10881077
}
10891078

10901079
impl FromUtf8Error {

src/libcollections/vec_deque.rs

+2-20
Original file line numberDiff line numberDiff line change
@@ -1115,15 +1115,6 @@ impl<T> VecDeque<T> {
11151115
self.pop_back()
11161116
}
11171117

1118-
/// deprecated
1119-
#[unstable(feature = "deque_extras",
1120-
reason = "the naming of this function may be altered",
1121-
issue = "27788")]
1122-
#[rustc_deprecated(since = "1.5.0", reason = "renamed to swap_remove_back")]
1123-
pub fn swap_back_remove(&mut self, index: usize) -> Option<T> {
1124-
self.swap_remove_back(index)
1125-
}
1126-
11271118
/// Removes an element from anywhere in the `VecDeque` and returns it,
11281119
/// replacing it with the first element.
11291120
///
@@ -1158,15 +1149,6 @@ impl<T> VecDeque<T> {
11581149
self.pop_front()
11591150
}
11601151

1161-
/// deprecated
1162-
#[unstable(feature = "deque_extras",
1163-
reason = "the naming of this function may be altered",
1164-
issue = "27788")]
1165-
#[rustc_deprecated(since = "1.5.0", reason = "renamed to swap_remove_front")]
1166-
pub fn swap_front_remove(&mut self, index: usize) -> Option<T> {
1167-
self.swap_remove_front(index)
1168-
}
1169-
11701152
/// Inserts an element at `index` within the `VecDeque`. Whichever
11711153
/// end is closer to the insertion point will be moved to make room,
11721154
/// and all the affected elements will be moved to new positions.
@@ -2178,15 +2160,15 @@ mod tests {
21782160
tester.push_front(i);
21792161
}
21802162
for i in 0..len {
2181-
assert_eq!(tester.swap_back_remove(i), Some(len * 2 - 1 - i));
2163+
assert_eq!(tester.swap_remove_back(i), Some(len * 2 - 1 - i));
21822164
}
21832165
} else {
21842166
for i in 0..len * 2 {
21852167
tester.push_back(i);
21862168
}
21872169
for i in 0..len {
21882170
let idx = tester.len() - 1 - i;
2189-
assert_eq!(tester.swap_front_remove(idx), Some(len * 2 - 1 - i));
2171+
assert_eq!(tester.swap_remove_front(idx), Some(len * 2 - 1 - i));
21902172
}
21912173
}
21922174
assert!(tester.tail < tester.cap());

src/libcollectionstest/binary_heap.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use std::collections::BinaryHeap;
1414
fn test_iterator() {
1515
let data = vec![5, 9, 3];
1616
let iterout = [9, 5, 3];
17-
let heap = BinaryHeap::from_vec(data);
17+
let heap = BinaryHeap::from(data);
1818
let mut i = 0;
1919
for el in &heap {
2020
assert_eq!(*el, iterout[i]);
@@ -26,7 +26,7 @@ fn test_iterator() {
2626
fn test_iterator_reverse() {
2727
let data = vec![5, 9, 3];
2828
let iterout = vec![3, 5, 9];
29-
let pq = BinaryHeap::from_vec(data);
29+
let pq = BinaryHeap::from(data);
3030

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

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

5050
let mut it = pq.into_iter();
5151

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

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

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

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

128128
#[test]
129129
fn test_push_pop() {
130-
let mut heap = BinaryHeap::from_vec(vec![5, 5, 2, 1, 3]);
130+
let mut heap = BinaryHeap::from(vec![5, 5, 2, 1, 3]);
131131
assert_eq!(heap.len(), 5);
132132
assert_eq!(heap.push_pop(6), 6);
133133
assert_eq!(heap.len(), 5);
@@ -141,7 +141,7 @@ fn test_push_pop() {
141141

142142
#[test]
143143
fn test_replace() {
144-
let mut heap = BinaryHeap::from_vec(vec![5, 5, 2, 1, 3]);
144+
let mut heap = BinaryHeap::from(vec![5, 5, 2, 1, 3]);
145145
assert_eq!(heap.len(), 5);
146146
assert_eq!(heap.replace(6).unwrap(), 5);
147147
assert_eq!(heap.len(), 5);
@@ -154,7 +154,7 @@ fn test_replace() {
154154
}
155155

156156
fn check_to_vec(mut data: Vec<i32>) {
157-
let heap = BinaryHeap::from_vec(data.clone());
157+
let heap = BinaryHeap::from(data.clone());
158158
let mut v = heap.clone().into_vec();
159159
v.sort();
160160
data.sort();

src/libcollectionstest/btree/map.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use std::collections::BTreeMap;
1212
use std::collections::Bound::{Excluded, Included, Unbounded, self};
1313
use std::collections::btree_map::Entry::{Occupied, Vacant};
14-
use std::iter::range_inclusive;
1514
use std::rc::Rc;
1615

1716
#[test]
@@ -188,7 +187,7 @@ fn test_range() {
188187
for i in 0..size {
189188
for j in i..size {
190189
let mut kvs = map.range(Included(&i), Included(&j)).map(|(&k, &v)| (k, v));
191-
let mut pairs = range_inclusive(i, j).map(|i| (i, i));
190+
let mut pairs = (i..j+1).map(|i| (i, i));
192191

193192
for (kv, pair) in kvs.by_ref().zip(pairs.by_ref()) {
194193
assert_eq!(kv, pair);

src/libcollectionstest/slice.rs

-11
Original file line numberDiff line numberDiff line change
@@ -866,17 +866,6 @@ fn test_vec_default() {
866866
t!(Vec<i32>);
867867
}
868868

869-
#[test]
870-
fn test_bytes_set_memory() {
871-
use std::slice::bytes::MutableByteVector;
872-
873-
let mut values = [1,2,3,4,5];
874-
values[0..5].set_memory(0xAB);
875-
assert!(values == [0xAB, 0xAB, 0xAB, 0xAB, 0xAB]);
876-
values[2..4].set_memory(0xFF);
877-
assert!(values == [0xAB, 0xAB, 0xFF, 0xFF, 0xAB]);
878-
}
879-
880869
#[test]
881870
#[should_panic]
882871
fn test_overflow_does_not_cause_segfault() {

0 commit comments

Comments
 (0)