diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2015-03-27 22:37:12 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2015-03-27 22:37:12 +0530 |
| commit | 82b375b44d408e7ddd1e3b2c1e64b0bf0c4376d1 (patch) | |
| tree | 21a5333e58e0434e9310251d1bdbc9429ecfa7bf /src/libcollections | |
| parent | 242ed0b7c0f6a21096f2cc3e1ad1bdb176d02545 (diff) | |
| parent | 36ef29abf7fa14dc9361d6b30ff7f8d18bfb4157 (diff) | |
| download | rust-82b375b44d408e7ddd1e3b2c1e64b0bf0c4376d1.tar.gz rust-82b375b44d408e7ddd1e3b2c1e64b0bf0c4376d1.zip | |
Rollup merge of #23738 - alexcrichton:snapshots, r=cmr
Diffstat (limited to 'src/libcollections')
| -rw-r--r-- | src/libcollections/bit.rs | 12 | ||||
| -rw-r--r-- | src/libcollections/btree/map.rs | 14 | ||||
| -rw-r--r-- | src/libcollections/btree/node.rs | 61 | ||||
| -rw-r--r-- | src/libcollections/string.rs | 28 | ||||
| -rw-r--r-- | src/libcollections/vec.rs | 74 | ||||
| -rw-r--r-- | src/libcollections/vec_deque.rs | 14 | ||||
| -rw-r--r-- | src/libcollections/vec_map.rs | 23 |
7 files changed, 0 insertions, 226 deletions
diff --git a/src/libcollections/bit.rs b/src/libcollections/bit.rs index 377b52a3dbe..fcf8c815694 100644 --- a/src/libcollections/bit.rs +++ b/src/libcollections/bit.rs @@ -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") { diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs index 04a692cc3ae..11407b5e496 100644 --- a/src/libcollections/btree/map.rs +++ b/src/libcollections/btree/map.rs @@ -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 diff --git a/src/libcollections/btree/node.rs b/src/libcollections/btree/node.rs index 23eafa41d8a..66f04d94ca1 100644 --- a/src/libcollections/btree/node.rs +++ b/src/libcollections/btree/node.rs @@ -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_| @@ -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_| diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index a61eaecd2b1..7131c1cd881 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -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] @@ -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] @@ -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] @@ -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) } diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index e71077c96c7..ee528255ae7 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -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]` @@ -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]` @@ -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) @@ -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) @@ -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) @@ -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 @@ -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) @@ -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) @@ -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) @@ -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() diff --git a/src/libcollections/vec_deque.rs b/src/libcollections/vec_deque.rs index af9db46f810..f5702be2f45 100644 --- a/src/libcollections/vec_deque.rs +++ b/src/libcollections/vec_deque.rs @@ -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") @@ -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") diff --git a/src/libcollections/vec_map.rs b/src/libcollections/vec_map.rs index 58f9101d1d3..8900c795045 100644 --- a/src/libcollections/vec_map.rs +++ b/src/libcollections/vec_map.rs @@ -836,17 +836,6 @@ impl<V> Extend<(usize, V)> for VecMap<V> { } } -#[cfg(stage0)] -impl<V> Index<usize> for VecMap<V> { - type Output = V; - - #[inline] - fn index<'a>(&'a self, i: &usize) -> &'a V { - self.get(i).expect("key not present") - } -} - -#[cfg(not(stage0))] impl<V> Index<usize> for VecMap<V> { type Output = V; @@ -856,7 +845,6 @@ impl<V> Index<usize> for VecMap<V> { } } -#[cfg(not(stage0))] impl<'a,V> Index<&'a usize> for VecMap<V> { type Output = V; @@ -866,16 +854,6 @@ impl<'a,V> Index<&'a usize> for VecMap<V> { } } -#[cfg(stage0)] -#[stable(feature = "rust1", since = "1.0.0")] -impl<V> IndexMut<usize> for VecMap<V> { - #[inline] - fn index_mut(&mut self, i: &usize) -> &mut V { - self.get_mut(&i).expect("key not present") - } -} - -#[cfg(not(stage0))] #[stable(feature = "rust1", since = "1.0.0")] impl<V> IndexMut<usize> for VecMap<V> { #[inline] @@ -884,7 +862,6 @@ impl<V> IndexMut<usize> for VecMap<V> { } } -#[cfg(not(stage0))] #[stable(feature = "rust1", since = "1.0.0")] impl<'a, V> IndexMut<&'a usize> for VecMap<V> { #[inline] |
