about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-06-10 19:33:04 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-06-17 09:07:17 -0700
commitb4a2823cd6c6f1a560469587f902f3a1f49d3c79 (patch)
tree162e8021fd73ffc7dfe0798dc99097138343977a /src/libcore
parentaa931e9c6f92557b99978f1cc562c99051190f79 (diff)
More test fixes and fallout of stability changes
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/iter.rs22
-rw-r--r--src/libcore/slice.rs4
2 files changed, 24 insertions, 2 deletions
diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs
index 2f45ffd1418..3026f91e853 100644
--- a/src/libcore/iter.rs
+++ b/src/libcore/iter.rs
@@ -1234,6 +1234,7 @@ impl<'a, I: DoubleEndedIterator + ?Sized> DoubleEndedIterator for &'a mut I {
              reason = "trait has not proven itself as a widely useful \
                        abstraction for iterators, and more time may be needed \
                        for iteration on the design")]
+#[allow(deprecated)]
 pub trait RandomAccessIterator: Iterator {
     /// Returns the number of indexable elements. At most `std::usize::MAX`
     /// elements are indexable, even if the iterator represents a longer range.
@@ -1313,6 +1314,7 @@ impl<I> DoubleEndedIterator for Rev<I> where I: DoubleEndedIterator {
 }
 
 #[unstable(feature = "iter_idx", reason = "trait is experimental")]
+#[allow(deprecated)]
 impl<I> RandomAccessIterator for Rev<I>
     where I: DoubleEndedIterator + RandomAccessIterator
 {
@@ -1416,6 +1418,7 @@ impl<'a, I, T: 'a> ExactSizeIterator for Cloned<I>
 {}
 
 #[unstable(feature = "iter_idx", reason = "trait is experimental")]
+#[allow(deprecated)]
 impl<'a, I, T: 'a> RandomAccessIterator for Cloned<I>
     where I: RandomAccessIterator<Item=&'a T>, T: Clone
 {
@@ -1463,6 +1466,7 @@ impl<I> Iterator for Cycle<I> where I: Clone + Iterator {
 }
 
 #[unstable(feature = "iter_idx", reason = "trait is experimental")]
+#[allow(deprecated)]
 impl<I> RandomAccessIterator for Cycle<I> where
     I: Clone + RandomAccessIterator,
 {
@@ -1577,6 +1581,7 @@ impl<A, B> DoubleEndedIterator for Chain<A, B> where
 }
 
 #[unstable(feature = "iter_idx", reason = "trait is experimental")]
+#[allow(deprecated)]
 impl<A, B> RandomAccessIterator for Chain<A, B> where
     A: RandomAccessIterator,
     B: RandomAccessIterator<Item = A::Item>,
@@ -1665,6 +1670,7 @@ impl<A, B> DoubleEndedIterator for Zip<A, B> where
 }
 
 #[unstable(feature = "iter_idx", reason = "trait is experimental")]
+#[allow(deprecated)]
 impl<A, B> RandomAccessIterator for Zip<A, B> where
     A: RandomAccessIterator,
     B: RandomAccessIterator
@@ -1719,6 +1725,7 @@ impl<B, I: DoubleEndedIterator, F> DoubleEndedIterator for Map<I, F> where
 }
 
 #[unstable(feature = "iter_idx", reason = "trait is experimental")]
+#[allow(deprecated)]
 impl<B, I: RandomAccessIterator, F> RandomAccessIterator for Map<I, F> where
     F: FnMut(I::Item) -> B,
 {
@@ -1893,6 +1900,7 @@ impl<I> DoubleEndedIterator for Enumerate<I> where
 }
 
 #[unstable(feature = "iter_idx", reason = "trait is experimental")]
+#[allow(deprecated)]
 impl<I> RandomAccessIterator for Enumerate<I> where I: RandomAccessIterator {
     #[inline]
     fn indexable(&self) -> usize {
@@ -2143,6 +2151,7 @@ impl<I> Iterator for Skip<I> where I: Iterator {
 }
 
 #[unstable(feature = "iter_idx", reason = "trait is experimental")]
+#[allow(deprecated)]
 impl<I> RandomAccessIterator for Skip<I> where I: RandomAccessIterator{
     #[inline]
     fn indexable(&self) -> usize {
@@ -2215,6 +2224,7 @@ impl<I> Iterator for Take<I> where I: Iterator{
 }
 
 #[unstable(feature = "iter_idx", reason = "trait is experimental")]
+#[allow(deprecated)]
 impl<I> RandomAccessIterator for Take<I> where I: RandomAccessIterator{
     #[inline]
     fn indexable(&self) -> usize {
@@ -2416,6 +2426,7 @@ impl<I> DoubleEndedIterator for Fuse<I> where I: DoubleEndedIterator {
 
 // Allow RandomAccessIterators to be fused without affecting random-access behavior
 #[unstable(feature = "iter_idx", reason = "trait is experimental")]
+#[allow(deprecated)]
 impl<I> RandomAccessIterator for Fuse<I> where I: RandomAccessIterator {
     #[inline]
     fn indexable(&self) -> usize {
@@ -2491,6 +2502,7 @@ impl<I: DoubleEndedIterator, F> DoubleEndedIterator for Inspect<I, F>
 }
 
 #[unstable(feature = "iter_idx", reason = "trait is experimental")]
+#[allow(deprecated)]
 impl<I: RandomAccessIterator, F> RandomAccessIterator for Inspect<I, F>
     where F: FnMut(&I::Item),
 {
@@ -2545,6 +2557,7 @@ impl<I: RandomAccessIterator, F> RandomAccessIterator for Inspect<I, F>
 #[deprecated(since = "1.2.0",
              reason = "has gained enough traction to retain its position \
                        in the standard library")]
+#[allow(deprecated)]
 pub struct Unfold<St, F> {
     f: F,
     /// Internal state that will be passed to the closure on the next iteration
@@ -2556,6 +2569,7 @@ pub struct Unfold<St, F> {
 #[deprecated(since = "1.2.0",
              reason = "has gained enough traction to retain its position \
                        in the standard library")]
+#[allow(deprecated)]
 impl<A, St, F> Unfold<St, F> where F: FnMut(&mut St) -> Option<A> {
     /// Creates a new iterator with the specified closure as the "iterator
     /// function" and an initial state to eventually pass to the closure
@@ -2569,6 +2583,7 @@ impl<A, St, F> Unfold<St, F> where F: FnMut(&mut St) -> Option<A> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
+#[allow(deprecated)]
 impl<A, St, F> Iterator for Unfold<St, F> where F: FnMut(&mut St) -> Option<A> {
     type Item = A;
 
@@ -2977,7 +2992,7 @@ impl<A: Clone> Iterator for Repeat<A> {
     type Item = A;
 
     #[inline]
-    fn next(&mut self) -> Option<A> { self.idx(0) }
+    fn next(&mut self) -> Option<A> { Some(self.element.clone()) }
     #[inline]
     fn size_hint(&self) -> (usize, Option<usize>) { (usize::MAX, None) }
 }
@@ -2985,10 +3000,11 @@ impl<A: Clone> Iterator for Repeat<A> {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<A: Clone> DoubleEndedIterator for Repeat<A> {
     #[inline]
-    fn next_back(&mut self) -> Option<A> { self.idx(0) }
+    fn next_back(&mut self) -> Option<A> { Some(self.element.clone()) }
 }
 
 #[unstable(feature = "iter_idx", reason = "trait is experimental")]
+#[allow(deprecated)]
 impl<A: Clone> RandomAccessIterator for Repeat<A> {
     #[inline]
     fn indexable(&self) -> usize { usize::MAX }
@@ -3004,6 +3020,7 @@ type IterateState<T, F> = (F, Option<T>, bool);
 #[deprecated(since = "1.2.0",
              reason = "has gained enough traction to retain its position \
                        in the standard library")]
+#[allow(deprecated)]
 pub type Iterate<T, F> = Unfold<IterateState<T, F>, fn(&mut IterateState<T, F>) -> Option<T>>;
 
 /// Creates a new iterator that produces an infinite sequence of
@@ -3012,6 +3029,7 @@ pub type Iterate<T, F> = Unfold<IterateState<T, F>, fn(&mut IterateState<T, F>)
 #[deprecated(since = "1.2.0",
              reason = "has gained enough traction to retain its position \
                        in the standard library")]
+#[allow(deprecated)]
 pub fn iterate<T, F>(seed: T, f: F) -> Iterate<T, F> where
     T: Clone,
     F: FnMut(T) -> T,
diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs
index 91acb0d6955..a8c995f37cc 100644
--- a/src/libcore/slice.rs
+++ b/src/libcore/slice.rs
@@ -802,6 +802,7 @@ impl<'a, T> Clone for Iter<'a, T> {
 }
 
 #[unstable(feature = "iter_idx", reason = "trait is experimental")]
+#[allow(deprecated)]
 impl<'a, T> RandomAccessIterator for Iter<'a, T> {
     #[inline]
     fn indexable(&self) -> usize {
@@ -1174,6 +1175,7 @@ impl<'a, T> DoubleEndedIterator for Windows<'a, T> {
 impl<'a, T> ExactSizeIterator for Windows<'a, T> {}
 
 #[unstable(feature = "iter_idx", reason = "trait is experimental")]
+#[allow(deprecated)]
 impl<'a, T> RandomAccessIterator for Windows<'a, T> {
     #[inline]
     fn indexable(&self) -> usize {
@@ -1261,6 +1263,7 @@ impl<'a, T> DoubleEndedIterator for Chunks<'a, T> {
 impl<'a, T> ExactSizeIterator for Chunks<'a, T> {}
 
 #[unstable(feature = "iter_idx", reason = "trait is experimental")]
+#[allow(deprecated)]
 impl<'a, T> RandomAccessIterator for Chunks<'a, T> {
     #[inline]
     fn indexable(&self) -> usize {
@@ -1520,6 +1523,7 @@ pub trait IntSliceExt<U, S> {
 macro_rules! impl_int_slice {
     ($u:ty, $s:ty, $t:ty) => {
         #[unstable(feature = "int_slice")]
+        #[allow(deprecated)]
         impl IntSliceExt<$u, $s> for [$t] {
             #[inline]
             fn as_unsigned(&self) -> &[$u] { unsafe { transmute(self) } }