Skip to content

Commit

Permalink
auto merge of rust-lang#18070 : alexcrichton/rust/spring-cleaning, r=…
Browse files Browse the repository at this point in the history
…aturon

This is a large spring-cleaning commit now that the 0.12.0 release has passed removing an amount of deprecated functionality. This removes a number of deprecated crates (all still available as cargo packages in the rust-lang organization) as well as a slew of deprecated functions. All `#[crate_id]` support has also been removed.

I tried to avoid anything that was recently deprecated, but I may have missed something! The major pain points of this commit is the fact that rustc/syntax have `#[allow(deprecated)]`, but I've removed that annotation so moving forward they should be cleaned up as we go.
  • Loading branch information
bors committed Oct 20, 2014
2 parents dcbd49f + 96445a5 commit 7d0cc44
Show file tree
Hide file tree
Showing 355 changed files with 1,364 additions and 12,821 deletions.
13 changes: 4 additions & 9 deletions mk/crates.mk
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@
# automatically generated for all stage/host/target combinations.
################################################################################

TARGET_CRATES := libc std green native flate arena glob term semver \
uuid serialize sync getopts collections num test time rand \
url log regex graphviz core rbml rlibc alloc rustrt \
TARGET_CRATES := libc std green native flate arena term \
serialize sync getopts collections test time rand \
log regex graphviz core rbml rlibc alloc rustrt \
unicode
HOST_CRATES := syntax rustc rustdoc fourcc hexfloat regex_macros fmt_macros \
HOST_CRATES := syntax rustc rustdoc regex_macros fmt_macros \
rustc_llvm rustc_back
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
TOOLS := compiletest rustdoc rustc
Expand Down Expand Up @@ -83,18 +83,13 @@ DEPS_glob := std
DEPS_serialize := std log
DEPS_rbml := std log serialize
DEPS_term := std log
DEPS_semver := std
DEPS_uuid := std serialize
DEPS_sync := core alloc rustrt collections
DEPS_getopts := std
DEPS_collections := core alloc unicode
DEPS_fourcc := rustc syntax std
DEPS_hexfloat := rustc syntax std
DEPS_num := std
DEPS_test := std getopts serialize rbml term time regex native:rust_test_helpers
DEPS_time := std serialize
DEPS_rand := core
DEPS_url := std
DEPS_log := std regex
DEPS_regex := std
DEPS_regex_macros = rustc syntax std regex
Expand Down
15 changes: 2 additions & 13 deletions src/libcollections/dlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,12 +475,6 @@ impl<T> DList<T> {
Items{nelem: self.len(), head: &self.list_head, tail: self.list_tail}
}

/// Deprecated: use `iter_mut`.
#[deprecated = "use iter_mut"]
pub fn mut_iter<'a>(&'a mut self) -> MutItems<'a, T> {
self.iter_mut()
}

/// Provides a forward iterator with mutable references.
#[inline]
pub fn iter_mut<'a>(&'a mut self) -> MutItems<'a, T> {
Expand All @@ -496,12 +490,6 @@ impl<T> DList<T> {
}
}

/// Deprecated: use `into_iter`.
#[deprecated = "use into_iter"]
pub fn move_iter(self) -> MoveItems<T> {
self.into_iter()
}

/// Consumes the list into an iterator yielding elements by value.
#[inline]
pub fn into_iter(self) -> MoveItems<T> {
Expand Down Expand Up @@ -870,7 +858,8 @@ mod tests {
let mut m = list_from(v.as_slice());
m.append(list_from(u.as_slice()));
check_links(&m);
let sum = v.append(u.as_slice());
let mut sum = v;
sum.push_all(u.as_slice());
assert_eq!(sum.len(), m.len());
for elt in sum.into_iter() {
assert_eq!(m.pop_front(), Some(elt))
Expand Down
34 changes: 0 additions & 34 deletions src/libcollections/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,40 +502,6 @@ pub trait Deque<T> : MutableSeq<T> {
/// ```
fn push_front(&mut self, elt: T);

/// Inserts an element last in the sequence.
///
/// # Example
///
/// ```ignore
/// use std::collections::{DList, Deque};
///
/// let mut d = DList::new();
/// d.push_back(1i);
/// d.push_back(2i);
/// assert_eq!(d.front(), Some(&1i));
/// ```
#[deprecated = "use the `push` method"]
fn push_back(&mut self, elt: T) { self.push(elt) }

/// Removes the last element and returns it, or `None` if the sequence is
/// empty.
///
/// # Example
///
/// ```ignore
/// use std::collections::{RingBuf, Deque};
///
/// let mut d = RingBuf::new();
/// d.push_back(1i);
/// d.push_back(2i);
///
/// assert_eq!(d.pop_back(), Some(2i));
/// assert_eq!(d.pop_back(), Some(1i));
/// assert_eq!(d.pop_back(), None);
/// ```
#[deprecated = "use the `pop` method"]
fn pop_back(&mut self) -> Option<T> { self.pop() }

/// Removes the first element and returns it, or `None` if the sequence is
/// empty.
///
Expand Down
14 changes: 0 additions & 14 deletions src/libcollections/priority_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,6 @@ impl<T: Ord> PriorityQueue<T> {
if self.is_empty() { None } else { Some(&self.data[0]) }
}

#[deprecated="renamed to `top`"]
pub fn maybe_top<'a>(&'a self) -> Option<&'a T> { self.top() }

/// Returns the number of elements the queue can hold without reallocating.
///
/// # Example
Expand Down Expand Up @@ -341,9 +338,6 @@ impl<T: Ord> PriorityQueue<T> {
}
}

#[deprecated="renamed to `pop`"]
pub fn maybe_pop(&mut self) -> Option<T> { self.pop() }

/// Pushes an item onto the queue.
///
/// # Example
Expand Down Expand Up @@ -417,14 +411,6 @@ impl<T: Ord> PriorityQueue<T> {
}
}

#[allow(dead_code)]
#[deprecated="renamed to `into_vec`"]
fn to_vec(self) -> Vec<T> { self.into_vec() }

#[allow(dead_code)]
#[deprecated="renamed to `into_sorted_vec`"]
fn to_sorted_vec(self) -> Vec<T> { self.into_sorted_vec() }

/// Consumes the `PriorityQueue` and returns the underlying vector
/// in arbitrary order.
///
Expand Down
108 changes: 42 additions & 66 deletions src/libcollections/ringbuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use core::cmp;
use core::default::Default;
use core::fmt;
use core::iter;
use core::slice;
use std::hash::{Writer, Hash};

use {Deque, Mutable, MutableSeq};
Expand Down Expand Up @@ -132,32 +133,6 @@ impl<T> RingBuf<T> {
elts: Vec::from_fn(cmp::max(MINIMUM_CAPACITY, n), |_| None)}
}

/// Retrieve an element in the `RingBuf` by index.
///
/// Fails if there is no element with the given index.
///
/// # Example
///
/// ```rust
/// #![allow(deprecated)]
///
/// use std::collections::RingBuf;
///
/// let mut buf = RingBuf::new();
/// buf.push(3i);
/// buf.push(4);
/// buf.push(5);
/// assert_eq!(buf.get(1), &4);
/// ```
#[deprecated = "prefer using indexing, e.g., ringbuf[0]"]
pub fn get<'a>(&'a self, i: uint) -> &'a T {
let idx = self.raw_index(i);
match self.elts[idx] {
None => fail!(),
Some(ref v) => v
}
}

/// Retrieves an element in the `RingBuf` by index.
///
/// Fails if there is no element with the given index.
Expand Down Expand Up @@ -250,12 +225,6 @@ impl<T> RingBuf<T> {
Items{index: 0, rindex: self.nelts, lo: self.lo, elts: self.elts.as_slice()}
}

/// Deprecated: use `iter_mut`
#[deprecated = "use iter_mut"]
pub fn mut_iter<'a>(&'a mut self) -> MutItems<'a, T> {
self.iter_mut()
}

/// Returns a front-to-back iterator which returns mutable references.
///
/// # Example
Expand Down Expand Up @@ -285,16 +254,20 @@ impl<T> RingBuf<T> {
// 0 to end_index
let (temp, remaining1) = self.elts.split_at_mut(start_index);
let (remaining2, _) = temp.split_at_mut(end_index);
MutItems { remaining1: remaining1,
remaining2: remaining2,
nelts: self.nelts }
MutItems {
remaining1: remaining1.iter_mut(),
remaining2: remaining2.iter_mut(),
nelts: self.nelts,
}
} else {
// Items to iterate goes from start_index to end_index:
let (empty, elts) = self.elts.split_at_mut(0);
let remaining1 = elts[mut start_index..end_index];
MutItems { remaining1: remaining1,
remaining2: empty,
nelts: self.nelts }
MutItems {
remaining1: remaining1.iter_mut(),
remaining2: empty.iter_mut(),
nelts: self.nelts,
}
}
}
}
Expand Down Expand Up @@ -356,26 +329,26 @@ impl<'a, T> RandomAccessIterator<&'a T> for Items<'a, T> {

/// `RingBuf` mutable iterator.
pub struct MutItems<'a, T:'a> {
remaining1: &'a mut [Option<T>],
remaining2: &'a mut [Option<T>],
remaining1: slice::MutItems<'a, Option<T>>,
remaining2: slice::MutItems<'a, Option<T>>,
nelts: uint,
}

impl<'a, T> Iterator<&'a mut T> for MutItems<'a, T> {
#[inline]
#[allow(deprecated)] // mut_shift_ref
fn next(&mut self) -> Option<&'a mut T> {
if self.nelts == 0 {
return None;
}
let r = if self.remaining1.len() > 0 {
&mut self.remaining1
} else {
assert!(self.remaining2.len() > 0);
&mut self.remaining2
};
self.nelts -= 1;
Some(r.mut_shift_ref().unwrap().get_mut_ref())
match self.remaining1.next() {
Some(ptr) => return Some(ptr.as_mut().unwrap()),
None => {}
}
match self.remaining2.next() {
Some(ptr) => return Some(ptr.as_mut().unwrap()),
None => unreachable!(),
}
}

#[inline]
Expand All @@ -386,19 +359,19 @@ impl<'a, T> Iterator<&'a mut T> for MutItems<'a, T> {

impl<'a, T> DoubleEndedIterator<&'a mut T> for MutItems<'a, T> {
#[inline]
#[allow(deprecated)] // mut_shift_ref
fn next_back(&mut self) -> Option<&'a mut T> {
if self.nelts == 0 {
return None;
}
let r = if self.remaining2.len() > 0 {
&mut self.remaining2
} else {
assert!(self.remaining1.len() > 0);
&mut self.remaining1
};
self.nelts -= 1;
Some(r.mut_pop_ref().unwrap().get_mut_ref())
match self.remaining2.next_back() {
Some(ptr) => return Some(ptr.as_mut().unwrap()),
None => {}
}
match self.remaining1.next_back() {
Some(ptr) => return Some(ptr.as_mut().unwrap()),
None => unreachable!(),
}
}
}

Expand Down Expand Up @@ -484,9 +457,12 @@ impl<S: Writer, A: Hash<S>> Hash<S> for RingBuf<A> {

impl<A> Index<uint, A> for RingBuf<A> {
#[inline]
#[allow(deprecated)]
fn index<'a>(&'a self, i: &uint) -> &'a A {
self.get(*i)
let idx = self.raw_index(*i);
match self.elts[idx] {
None => fail!(),
Some(ref v) => v,
}
}
}

Expand Down Expand Up @@ -576,14 +552,14 @@ mod tests {
assert_eq!(d.len(), 3u);
d.push_front(1);
assert_eq!(d.len(), 4u);
debug!("{}", d.get(0));
debug!("{}", d.get(1));
debug!("{}", d.get(2));
debug!("{}", d.get(3));
assert_eq!(*d.get(0), 1);
assert_eq!(*d.get(1), 2);
assert_eq!(*d.get(2), 3);
assert_eq!(*d.get(3), 4);
debug!("{}", d[0]);
debug!("{}", d[1]);
debug!("{}", d[2]);
debug!("{}", d[3]);
assert_eq!(d[0], 1);
assert_eq!(d[1], 2);
assert_eq!(d[2], 3);
assert_eq!(d[3], 4);
}

#[cfg(test)]
Expand Down
Loading

0 comments on commit 7d0cc44

Please sign in to comment.