Skip to content

Commit

Permalink
Rollup merge of rust-lang#23738 - alexcrichton:snapshots, r=cmr
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Mar 27, 2015
2 parents 242ed0b + 36ef29a commit 82b375b
Show file tree
Hide file tree
Showing 29 changed files with 25 additions and 1,166 deletions.
4 changes: 2 additions & 2 deletions src/driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#![cfg_attr(rustdoc, feature(rustdoc))]

#[cfg(rustdoc)]
extern crate "rustdoc" as this;
extern crate rustdoc as this;

#[cfg(rustc)]
extern crate "rustc_driver" as this;
extern crate rustc_driver as this;

fn main() { this::main() }
12 changes: 0 additions & 12 deletions src/libcollections/bit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,18 +171,6 @@ pub struct BitVec {
impl Index<usize> for BitVec {
type Output = bool;


#[cfg(stage0)]
#[inline]
fn index(&self, i: &usize) -> &bool {
if self.get(*i).expect("index out of bounds") {
&TRUE
} else {
&FALSE
}
}

#[cfg(not(stage0))]
#[inline]
fn index(&self, i: usize) -> &bool {
if self.get(i).expect("index out of bounds") {
Expand Down
14 changes: 0 additions & 14 deletions src/libcollections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -915,20 +915,6 @@ impl<K: Debug, V: Debug> Debug for BTreeMap<K, V> {
}
}

#[cfg(stage0)]
#[stable(feature = "rust1", since = "1.0.0")]
impl<K: Ord, Q: ?Sized, V> Index<Q> for BTreeMap<K, V>
where K: Borrow<Q>, Q: Ord
{
type Output = V;

#[inline]
fn index(&self, key: &Q) -> &V {
self.get(key).expect("no entry found for key")
}
}

#[cfg(not(stage0))]
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, K: Ord, Q: ?Sized, V> Index<&'a Q> for BTreeMap<K, V>
where K: Borrow<Q>, Q: Ord
Expand Down
61 changes: 0 additions & 61 deletions src/libcollections/btree/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1524,36 +1524,6 @@ macro_rules! node_slice_impl {
}

/// Returns a sub-slice with elements starting with `min_key`.
#[cfg(stage0)]
pub fn slice_from(self, min_key: &K) -> $NodeSlice<'a, K, V> {
// _______________
// |_1_|_3_|_5_|_7_|
// | | | | |
// 0 0 1 1 2 2 3 3 4 index
// | | | | |
// \___|___|___|___/ slice_from(&0); pos = 0
// \___|___|___/ slice_from(&2); pos = 1
// |___|___|___/ slice_from(&3); pos = 1; result.head_is_edge = false
// \___|___/ slice_from(&4); pos = 2
// \___/ slice_from(&6); pos = 3
// \|/ slice_from(&999); pos = 4
let (pos, pos_is_kv) = self.search_linear(min_key);
$NodeSlice {
has_edges: self.has_edges,
edges: if !self.has_edges {
self.edges
} else {
self.edges.$index(&(pos ..))
},
keys: &self.keys[pos ..],
vals: self.vals.$index(&(pos ..)),
head_is_edge: !pos_is_kv,
tail_is_edge: self.tail_is_edge,
}
}

/// Returns a sub-slice with elements starting with `min_key`.
#[cfg(not(stage0))]
pub fn slice_from(self, min_key: &K) -> $NodeSlice<'a, K, V> {
// _______________
// |_1_|_3_|_5_|_7_|
Expand Down Expand Up @@ -1582,37 +1552,6 @@ macro_rules! node_slice_impl {
}

/// Returns a sub-slice with elements up to and including `max_key`.
#[cfg(stage0)]
pub fn slice_to(self, max_key: &K) -> $NodeSlice<'a, K, V> {
// _______________
// |_1_|_3_|_5_|_7_|
// | | | | |
// 0 0 1 1 2 2 3 3 4 index
// | | | | |
//\|/ | | | | slice_to(&0); pos = 0
// \___/ | | | slice_to(&2); pos = 1
// \___|___| | | slice_to(&3); pos = 1; result.tail_is_edge = false
// \___|___/ | | slice_to(&4); pos = 2
// \___|___|___/ | slice_to(&6); pos = 3
// \___|___|___|___/ slice_to(&999); pos = 4
let (pos, pos_is_kv) = self.search_linear(max_key);
let pos = pos + if pos_is_kv { 1 } else { 0 };
$NodeSlice {
has_edges: self.has_edges,
edges: if !self.has_edges {
self.edges
} else {
self.edges.$index(&(.. (pos + 1)))
},
keys: &self.keys[..pos],
vals: self.vals.$index(&(.. pos)),
head_is_edge: self.head_is_edge,
tail_is_edge: !pos_is_kv,
}
}

/// Returns a sub-slice with elements up to and including `max_key`.
#[cfg(not(stage0))]
pub fn slice_to(self, max_key: &K) -> $NodeSlice<'a, K, V> {
// _______________
// |_1_|_3_|_5_|_7_|
Expand Down
28 changes: 0 additions & 28 deletions src/libcollections/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -903,13 +903,6 @@ impl<'a> Add<&'a str> for String {
impl ops::Index<ops::Range<usize>> for String {
type Output = str;

#[cfg(stage0)]
#[inline]
fn index(&self, index: &ops::Range<usize>) -> &str {
&self[..][*index]
}

#[cfg(not(stage0))]
#[inline]
fn index(&self, index: ops::Range<usize>) -> &str {
&self[..][index]
Expand All @@ -919,13 +912,6 @@ impl ops::Index<ops::Range<usize>> for String {
impl ops::Index<ops::RangeTo<usize>> for String {
type Output = str;

#[cfg(stage0)]
#[inline]
fn index(&self, index: &ops::RangeTo<usize>) -> &str {
&self[..][*index]
}

#[cfg(not(stage0))]
#[inline]
fn index(&self, index: ops::RangeTo<usize>) -> &str {
&self[..][index]
Expand All @@ -935,13 +921,6 @@ impl ops::Index<ops::RangeTo<usize>> for String {
impl ops::Index<ops::RangeFrom<usize>> for String {
type Output = str;

#[cfg(stage0)]
#[inline]
fn index(&self, index: &ops::RangeFrom<usize>) -> &str {
&self[..][*index]
}

#[cfg(not(stage0))]
#[inline]
fn index(&self, index: ops::RangeFrom<usize>) -> &str {
&self[..][index]
Expand All @@ -951,13 +930,6 @@ impl ops::Index<ops::RangeFrom<usize>> for String {
impl ops::Index<ops::RangeFull> for String {
type Output = str;

#[cfg(stage0)]
#[inline]
fn index(&self, _index: &ops::RangeFull) -> &str {
unsafe { mem::transmute(&*self.vec) }
}

#[cfg(not(stage0))]
#[inline]
fn index(&self, _index: ops::RangeFull) -> &str {
unsafe { mem::transmute(&*self.vec) }
Expand Down
74 changes: 0 additions & 74 deletions src/libcollections/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1343,15 +1343,6 @@ impl<T: Hash> Hash for Vec<T> {
impl<T> Index<usize> for Vec<T> {
type Output = T;


#[cfg(stage0)]
#[inline]
fn index(&self, index: &usize) -> &T {
// NB built-in indexing via `&[T]`
&(**self)[*index]
}

#[cfg(not(stage0))]
#[inline]
fn index(&self, index: usize) -> &T {
// NB built-in indexing via `&[T]`
Expand All @@ -1361,15 +1352,6 @@ impl<T> Index<usize> for Vec<T> {

#[stable(feature = "rust1", since = "1.0.0")]
impl<T> IndexMut<usize> for Vec<T> {

#[cfg(stage0)]
#[inline]
fn index_mut(&mut self, index: &usize) -> &mut T {
// NB built-in indexing via `&mut [T]`
&mut (**self)[*index]
}

#[cfg(not(stage0))]
#[inline]
fn index_mut(&mut self, index: usize) -> &mut T {
// NB built-in indexing via `&mut [T]`
Expand All @@ -1382,13 +1364,6 @@ impl<T> IndexMut<usize> for Vec<T> {
impl<T> ops::Index<ops::Range<usize>> for Vec<T> {
type Output = [T];

#[cfg(stage0)]
#[inline]
fn index(&self, index: &ops::Range<usize>) -> &[T] {
Index::index(&**self, index)
}

#[cfg(not(stage0))]
#[inline]
fn index(&self, index: ops::Range<usize>) -> &[T] {
Index::index(&**self, index)
Expand All @@ -1398,13 +1373,6 @@ impl<T> ops::Index<ops::Range<usize>> for Vec<T> {
impl<T> ops::Index<ops::RangeTo<usize>> for Vec<T> {
type Output = [T];

#[cfg(stage0)]
#[inline]
fn index(&self, index: &ops::RangeTo<usize>) -> &[T] {
Index::index(&**self, index)
}

#[cfg(not(stage0))]
#[inline]
fn index(&self, index: ops::RangeTo<usize>) -> &[T] {
Index::index(&**self, index)
Expand All @@ -1414,13 +1382,6 @@ impl<T> ops::Index<ops::RangeTo<usize>> for Vec<T> {
impl<T> ops::Index<ops::RangeFrom<usize>> for Vec<T> {
type Output = [T];

#[cfg(stage0)]
#[inline]
fn index(&self, index: &ops::RangeFrom<usize>) -> &[T] {
Index::index(&**self, index)
}

#[cfg(not(stage0))]
#[inline]
fn index(&self, index: ops::RangeFrom<usize>) -> &[T] {
Index::index(&**self, index)
Expand All @@ -1430,13 +1391,6 @@ impl<T> ops::Index<ops::RangeFrom<usize>> for Vec<T> {
impl<T> ops::Index<ops::RangeFull> for Vec<T> {
type Output = [T];

#[cfg(stage0)]
#[inline]
fn index(&self, _index: &ops::RangeFull) -> &[T] {
self
}

#[cfg(not(stage0))]
#[inline]
fn index(&self, _index: ops::RangeFull) -> &[T] {
self
Expand All @@ -1446,13 +1400,6 @@ impl<T> ops::Index<ops::RangeFull> for Vec<T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> ops::IndexMut<ops::Range<usize>> for Vec<T> {

#[cfg(stage0)]
#[inline]
fn index_mut(&mut self, index: &ops::Range<usize>) -> &mut [T] {
IndexMut::index_mut(&mut **self, index)
}

#[cfg(not(stage0))]
#[inline]
fn index_mut(&mut self, index: ops::Range<usize>) -> &mut [T] {
IndexMut::index_mut(&mut **self, index)
Expand All @@ -1461,13 +1408,6 @@ impl<T> ops::IndexMut<ops::Range<usize>> for Vec<T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> ops::IndexMut<ops::RangeTo<usize>> for Vec<T> {

#[cfg(stage0)]
#[inline]
fn index_mut(&mut self, index: &ops::RangeTo<usize>) -> &mut [T] {
IndexMut::index_mut(&mut **self, index)
}

#[cfg(not(stage0))]
#[inline]
fn index_mut(&mut self, index: ops::RangeTo<usize>) -> &mut [T] {
IndexMut::index_mut(&mut **self, index)
Expand All @@ -1476,13 +1416,6 @@ impl<T> ops::IndexMut<ops::RangeTo<usize>> for Vec<T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> ops::IndexMut<ops::RangeFrom<usize>> for Vec<T> {

#[cfg(stage0)]
#[inline]
fn index_mut(&mut self, index: &ops::RangeFrom<usize>) -> &mut [T] {
IndexMut::index_mut(&mut **self, index)
}

#[cfg(not(stage0))]
#[inline]
fn index_mut(&mut self, index: ops::RangeFrom<usize>) -> &mut [T] {
IndexMut::index_mut(&mut **self, index)
Expand All @@ -1491,13 +1424,6 @@ impl<T> ops::IndexMut<ops::RangeFrom<usize>> for Vec<T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> ops::IndexMut<ops::RangeFull> for Vec<T> {

#[cfg(stage0)]
#[inline]
fn index_mut(&mut self, _index: &ops::RangeFull) -> &mut [T] {
self.as_mut_slice()
}

#[cfg(not(stage0))]
#[inline]
fn index_mut(&mut self, _index: ops::RangeFull) -> &mut [T] {
self.as_mut_slice()
Expand Down
14 changes: 0 additions & 14 deletions src/libcollections/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1705,13 +1705,6 @@ impl<A: Hash> Hash for VecDeque<A> {
impl<A> Index<usize> for VecDeque<A> {
type Output = A;

#[cfg(stage0)]
#[inline]
fn index(&self, i: &usize) -> &A {
self.get(*i).expect("Out of bounds access")
}

#[cfg(not(stage0))]
#[inline]
fn index(&self, i: usize) -> &A {
self.get(i).expect("Out of bounds access")
Expand All @@ -1720,13 +1713,6 @@ impl<A> Index<usize> for VecDeque<A> {

#[stable(feature = "rust1", since = "1.0.0")]
impl<A> IndexMut<usize> for VecDeque<A> {
#[cfg(stage0)]
#[inline]
fn index_mut(&mut self, i: &usize) -> &mut A {
self.get_mut(*i).expect("Out of bounds access")
}

#[cfg(not(stage0))]
#[inline]
fn index_mut(&mut self, i: usize) -> &mut A {
self.get_mut(i).expect("Out of bounds access")
Expand Down
Loading

0 comments on commit 82b375b

Please sign in to comment.