From c6f4a03d12d97162e2775c14ab006d355b04126d Mon Sep 17 00:00:00 2001 From: Aaron Turon Date: Sun, 4 Jan 2015 16:16:55 -0800 Subject: [PATCH] Stabilization of impls and fallout from stabilization --- src/liballoc/arc.rs | 6 +++--- src/liballoc/boxed.rs | 2 ++ src/liballoc/rc.rs | 6 +++--- src/libcollections/binary_heap.rs | 4 ++++ src/libcollections/lib.rs | 3 +-- src/libcollections/slice.rs | 1 + src/libcollections/str.rs | 6 ++++++ src/libcollections/string.rs | 8 ++++---- src/libcollections/vec.rs | 19 ++++++++++++++---- src/libcore/borrow.rs | 1 + src/libcore/cell.rs | 6 +++--- src/libcore/char.rs | 2 ++ src/libcore/iter.rs | 2 +- src/libcore/ops.rs | 4 ++++ src/libcore/option.rs | 9 +++++++++ src/libcore/prelude.rs | 3 +-- src/libcore/result.rs | 9 +++++++++ src/libcore/slice.rs | 31 +++++++++++++++--------------- src/libcore/str/mod.rs | 30 ++++++++++++++++++++++------- src/libstd/collections/hash/set.rs | 2 +- src/libstd/io/buffered.rs | 2 +- src/libstd/prelude/v1.rs | 2 -- src/libstd/sync/condvar.rs | 1 + src/libstd/sync/mpsc/mod.rs | 5 ++++- src/libstd/sync/mpsc/mpsc_queue.rs | 1 + src/libstd/sync/mutex.rs | 4 ++++ src/libstd/sync/rwlock.rs | 6 ++++++ src/libstd/sync/semaphore.rs | 1 + src/libstd/thread.rs | 1 + 29 files changed, 128 insertions(+), 49 deletions(-) diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 88f02d6573e..25f80ad11bd 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -246,7 +246,7 @@ impl BorrowFrom> for T { } } -#[experimental = "Deref is experimental."] +#[stable] impl Deref for Arc { type Target = T; @@ -290,7 +290,7 @@ impl Arc { } #[unsafe_destructor] -#[experimental = "waiting on stability of Drop"] +#[stable] impl Drop for Arc { /// Drops the `Arc`. /// @@ -418,7 +418,7 @@ impl Clone for Weak { } #[unsafe_destructor] -#[experimental = "Weak pointers may not belong in this module."] +#[stable] impl Drop for Weak { /// Drops the `Weak`. /// diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 2c318181b09..33d1cc7f4c7 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -155,12 +155,14 @@ impl fmt::Show for Box { } } +#[stable] impl Deref for Box { type Target = T; fn deref(&self) -> &T { &**self } } +#[stable] impl DerefMut for Box { fn deref_mut(&mut self) -> &mut T { &mut **self } } diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index c4b455aff5c..175bba4e71d 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -354,7 +354,7 @@ impl BorrowFrom> for T { } } -#[experimental = "Deref is experimental."] +#[stable] impl Deref for Rc { type Target = T; @@ -365,7 +365,7 @@ impl Deref for Rc { } #[unsafe_destructor] -#[experimental = "Drop is experimental."] +#[stable] impl Drop for Rc { /// Drops the `Rc`. /// @@ -656,7 +656,7 @@ impl Weak { } #[unsafe_destructor] -#[experimental = "Weak pointers may not belong in this module."] +#[stable] impl Drop for Weak { /// Drops the `Weak`. /// diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs index 619a6e94271..01693391abe 100644 --- a/src/libcollections/binary_heap.rs +++ b/src/libcollections/binary_heap.rs @@ -562,11 +562,13 @@ impl BinaryHeap { } /// `BinaryHeap` iterator. +#[stable] pub struct Iter <'a, T: 'a> { iter: slice::Iter<'a, T>, } // FIXME(#19839) Remove in favor of `#[derive(Clone)]` +#[stable] impl<'a, T> Clone for Iter<'a, T> { fn clone(&self) -> Iter<'a, T> { Iter { iter: self.iter.clone() } @@ -594,6 +596,7 @@ impl<'a, T> DoubleEndedIterator for Iter<'a, T> { impl<'a, T> ExactSizeIterator for Iter<'a, T> {} /// An iterator that moves out of a `BinaryHeap`. +#[stable] pub struct IntoIter { iter: vec::IntoIter, } @@ -619,6 +622,7 @@ impl DoubleEndedIterator for IntoIter { impl ExactSizeIterator for IntoIter {} /// An iterator that drains a `BinaryHeap`. +#[unstable = "recent addition"] pub struct Drain<'a, T: 'a> { iter: vec::Drain<'a, T>, } diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index 72cdae8ba31..c9b090bfb23 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -113,8 +113,7 @@ mod prelude { pub use core::iter::range; pub use core::iter::{FromIterator, Extend, IteratorExt}; pub use core::iter::{Iterator, DoubleEndedIterator, RandomAccessIterator}; - pub use core::iter::{IteratorCloneExt, CloneIteratorExt}; - pub use core::iter::{IteratorOrdExt, MutableDoubleEndedIterator, ExactSizeIterator}; + pub use core::iter::{ExactSizeIterator}; pub use core::kinds::{Copy, Send, Sized, Sync}; pub use core::mem::drop; pub use core::ops::{Drop, Fn, FnMut, FnOnce}; diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index ceccca561ae..e3bf5d63b1d 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -1092,6 +1092,7 @@ struct SizeDirection { dir: Direction, } +#[stable] impl Iterator for ElementSwaps { type Item = (uint, uint); diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index ecf17820d2d..9f3ab6dd5c0 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -165,6 +165,7 @@ enum DecompositionType { /// External iterator for a string's decomposition's characters. /// Use with the `std::iter` module. #[derive(Clone)] +#[unstable] pub struct Decompositions<'a> { kind: DecompositionType, iter: Chars<'a>, @@ -172,6 +173,7 @@ pub struct Decompositions<'a> { sorted: bool } +#[stable] impl<'a> Iterator for Decompositions<'a> { type Item = char; @@ -253,6 +255,7 @@ enum RecompositionState { /// External iterator for a string's recomposition's characters. /// Use with the `std::iter` module. #[derive(Clone)] +#[unstable] pub struct Recompositions<'a> { iter: Decompositions<'a>, state: RecompositionState, @@ -261,6 +264,7 @@ pub struct Recompositions<'a> { last_ccc: Option } +#[stable] impl<'a> Iterator for Recompositions<'a> { type Item = char; @@ -348,10 +352,12 @@ impl<'a> Iterator for Recompositions<'a> { /// External iterator for a string's UTF16 codeunits. /// Use with the `std::iter` module. #[derive(Clone)] +#[unstable] pub struct Utf16Units<'a> { encoder: Utf16Encoder> } +#[stable] impl<'a> Iterator for Utf16Units<'a> { type Item = u16; diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index e7451331908..8ffca7e57b2 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -711,7 +711,7 @@ impl fmt::Show for FromUtf16Error { } } -#[experimental = "waiting on FromIterator stabilization"] +#[stable] impl FromIterator for String { fn from_iter>(iterator: I) -> String { let mut buf = String::new(); @@ -720,7 +720,7 @@ impl FromIterator for String { } } -#[experimental = "waiting on FromIterator stabilization"] +#[stable] impl<'a> FromIterator<&'a str> for String { fn from_iter>(iterator: I) -> String { let mut buf = String::new(); @@ -832,7 +832,7 @@ impl hash::Hash for String { } } -#[experimental = "waiting on Add stabilization"] +#[unstable = "recent addition, needs more experience"] impl<'a> Add<&'a str> for String { type Output = String; @@ -864,7 +864,7 @@ impl ops::Slice for String { } } -#[experimental = "waiting on Deref stabilization"] +#[stable] impl ops::Deref for String { type Target = str; diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index b8f97799c97..b8bcba84cee 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -1272,19 +1272,19 @@ impl ops::SliceMut for Vec { } } -#[experimental = "waiting on Deref stability"] +#[stable] impl ops::Deref for Vec { type Target = [T]; fn deref<'a>(&'a self) -> &'a [T] { self.as_slice() } } -#[experimental = "waiting on DerefMut stability"] +#[stable] impl ops::DerefMut for Vec { fn deref_mut<'a>(&'a mut self) -> &'a mut [T] { self.as_mut_slice() } } -#[experimental = "waiting on FromIterator stability"] +#[stable] impl FromIterator for Vec { #[inline] fn from_iter>(mut iterator: I) -> Vec { @@ -1414,6 +1414,7 @@ impl AsSlice for Vec { } } +#[unstable = "recent addition, needs more experience"] impl<'a, T: Clone> Add<&'a [T]> for Vec { type Output = Vec; @@ -1425,6 +1426,7 @@ impl<'a, T: Clone> Add<&'a [T]> for Vec { } #[unsafe_destructor] +#[stable] impl Drop for Vec { fn drop(&mut self) { // This is (and should always remain) a no-op if the fields are @@ -1470,6 +1472,7 @@ impl<'a> fmt::Writer for Vec { /// A clone-on-write vector pub type CowVec<'a, T> = Cow<'a, Vec, [T]>; +#[unstable] impl<'a, T> FromIterator for CowVec<'a, T> where T: Clone { fn from_iter>(it: I) -> CowVec<'a, T> { Cow::Owned(FromIterator::from_iter(it)) @@ -1515,6 +1518,7 @@ impl IntoIter { } } +#[stable] impl Iterator for IntoIter { type Item = T; @@ -1551,6 +1555,7 @@ impl Iterator for IntoIter { } } +#[stable] impl DoubleEndedIterator for IntoIter { #[inline] fn next_back<'a>(&'a mut self) -> Option { @@ -1574,9 +1579,11 @@ impl DoubleEndedIterator for IntoIter { } } +#[stable] impl ExactSizeIterator for IntoIter {} #[unsafe_destructor] +#[stable] impl Drop for IntoIter { fn drop(&mut self) { // destroy the remaining elements @@ -1598,6 +1605,7 @@ pub struct Drain<'a, T> { marker: ContravariantLifetime<'a>, } +#[stable] impl<'a, T> Iterator for Drain<'a, T> { type Item = T; @@ -1634,6 +1642,7 @@ impl<'a, T> Iterator for Drain<'a, T> { } } +#[stable] impl<'a, T> DoubleEndedIterator for Drain<'a, T> { #[inline] fn next_back(&mut self) -> Option { @@ -1657,9 +1666,11 @@ impl<'a, T> DoubleEndedIterator for Drain<'a, T> { } } +#[stable] impl<'a, T> ExactSizeIterator for Drain<'a, T> {} #[unsafe_destructor] +#[stable] impl<'a, T> Drop for Drain<'a, T> { fn drop(&mut self) { // self.ptr == self.end == null if drop has already been called, @@ -1692,7 +1703,7 @@ impl<'a, T> Deref for DerefVec<'a, T> { // Prevent the inner `Vec` from attempting to deallocate memory. #[unsafe_destructor] -#[experimental] +#[stable] impl<'a, T> Drop for DerefVec<'a, T> { fn drop(&mut self) { self.x.len = 0; diff --git a/src/libcore/borrow.rs b/src/libcore/borrow.rs index 7e4d73d598d..63b3be00f55 100644 --- a/src/libcore/borrow.rs +++ b/src/libcore/borrow.rs @@ -191,6 +191,7 @@ impl<'a, T, Sized? B> Cow<'a, T, B> where B: ToOwned { } } +#[stable] impl<'a, T, Sized? B> Deref for Cow<'a, T, B> where B: ToOwned { type Target = B; diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index eb772388dce..fd18d6ac3f3 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -419,7 +419,7 @@ pub struct Ref<'b, T:'b> { _borrow: BorrowRef<'b>, } -#[unstable = "waiting for `Deref` to become stable"] +#[stable] impl<'b, T> Deref for Ref<'b, T> { type Target = T; @@ -477,7 +477,7 @@ pub struct RefMut<'b, T:'b> { _borrow: BorrowRefMut<'b>, } -#[unstable = "waiting for `Deref` to become stable"] +#[stable] impl<'b, T> Deref for RefMut<'b, T> { type Target = T; @@ -487,7 +487,7 @@ impl<'b, T> Deref for RefMut<'b, T> { } } -#[unstable = "waiting for `DerefMut` to become stable"] +#[stable] impl<'b, T> DerefMut for RefMut<'b, T> { #[inline] fn deref_mut<'a>(&'a mut self) -> &'a mut T { diff --git a/src/libcore/char.rs b/src/libcore/char.rs index 291b7f2ece4..caac894c0da 100644 --- a/src/libcore/char.rs +++ b/src/libcore/char.rs @@ -314,6 +314,7 @@ pub struct EscapeUnicode { } #[derive(Clone)] +#[unstable] enum EscapeUnicodeState { Backslash, Type, @@ -375,6 +376,7 @@ pub struct EscapeDefault { } #[derive(Clone)] +#[unstable] enum EscapeDefaultState { Backslash(char), Char(char), diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 4782a763dc8..e5753f6cc2e 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -2401,7 +2401,7 @@ impl Unfold where F: FnMut(&mut St) -> Option { } } -#[experimental] +#[stable] impl Iterator for Unfold where F: FnMut(&mut St) -> Option { type Item = A; diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs index da2e95832e7..74702c66f7b 100644 --- a/src/libcore/ops.rs +++ b/src/libcore/ops.rs @@ -984,6 +984,7 @@ pub struct Range { // FIXME(#19391) needs a snapshot //impl> Iterator for Range { +#[unstable = "API still in development"] impl Iterator for Range { type Item = Idx; @@ -1008,6 +1009,7 @@ impl Iterator for Range { } } +#[unstable = "API still in development"] impl DoubleEndedIterator for Range { #[inline] fn next_back(&mut self) -> Option { @@ -1020,6 +1022,7 @@ impl DoubleEndedIterator for Range { } } +#[unstable = "API still in development"] impl ExactSizeIterator for Range {} /// A range which is only bounded below. @@ -1031,6 +1034,7 @@ pub struct RangeFrom { pub start: Idx, } +#[unstable = "API still in development"] impl Iterator for RangeFrom { type Item = Idx; diff --git a/src/libcore/option.rs b/src/libcore/option.rs index a9a1857ec97..39d0f024d4d 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -807,6 +807,7 @@ impl ExactSizeIterator for Item {} #[stable] pub struct Iter<'a, A: 'a> { inner: Item<&'a A> } +#[stable] impl<'a, A> Iterator for Iter<'a, A> { type Item = &'a A; @@ -816,11 +817,13 @@ impl<'a, A> Iterator for Iter<'a, A> { fn size_hint(&self) -> (uint, Option) { self.inner.size_hint() } } +#[stable] impl<'a, A> DoubleEndedIterator for Iter<'a, A> { #[inline] fn next_back(&mut self) -> Option<&'a A> { self.inner.next_back() } } +#[stable] impl<'a, A> ExactSizeIterator for Iter<'a, A> {} #[stable] @@ -834,6 +837,7 @@ impl<'a, A> Clone for Iter<'a, A> { #[stable] pub struct IterMut<'a, A: 'a> { inner: Item<&'a mut A> } +#[stable] impl<'a, A> Iterator for IterMut<'a, A> { type Item = &'a mut A; @@ -843,17 +847,20 @@ impl<'a, A> Iterator for IterMut<'a, A> { fn size_hint(&self) -> (uint, Option) { self.inner.size_hint() } } +#[stable] impl<'a, A> DoubleEndedIterator for IterMut<'a, A> { #[inline] fn next_back(&mut self) -> Option<&'a mut A> { self.inner.next_back() } } +#[stable] impl<'a, A> ExactSizeIterator for IterMut<'a, A> {} /// An iterator over the item contained inside an Option. #[stable] pub struct IntoIter { inner: Item } +#[stable] impl Iterator for IntoIter { type Item = A; @@ -863,11 +870,13 @@ impl Iterator for IntoIter { fn size_hint(&self) -> (uint, Option) { self.inner.size_hint() } } +#[stable] impl DoubleEndedIterator for IntoIter { #[inline] fn next_back(&mut self) -> Option { self.inner.next_back() } } +#[stable] impl ExactSizeIterator for IntoIter {} ///////////////////////////////////////////////////////////////////////////// diff --git a/src/libcore/prelude.rs b/src/libcore/prelude.rs index d4aca1bb73c..e88cb73c8a9 100644 --- a/src/libcore/prelude.rs +++ b/src/libcore/prelude.rs @@ -43,8 +43,7 @@ pub use clone::Clone; pub use cmp::{PartialEq, PartialOrd, Eq, Ord}; pub use iter::{Extend, IteratorExt}; pub use iter::{Iterator, DoubleEndedIterator}; -pub use iter::{IteratorCloneExt, CloneIteratorExt}; -pub use iter::{IteratorOrdExt, ExactSizeIterator}; +pub use iter::{ExactSizeIterator}; pub use option::Option::{self, Some, None}; pub use ptr::{PtrExt, MutPtrExt}; pub use result::Result::{self, Ok, Err}; diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 7135faaa765..7293ed6455b 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -807,6 +807,7 @@ impl AsSlice for Result { #[stable] pub struct Iter<'a, T: 'a> { inner: Option<&'a T> } +#[stable] impl<'a, T> Iterator for Iter<'a, T> { type Item = &'a T; @@ -819,11 +820,13 @@ impl<'a, T> Iterator for Iter<'a, T> { } } +#[stable] impl<'a, T> DoubleEndedIterator for Iter<'a, T> { #[inline] fn next_back(&mut self) -> Option<&'a T> { self.inner.take() } } +#[stable] impl<'a, T> ExactSizeIterator for Iter<'a, T> {} impl<'a, T> Clone for Iter<'a, T> { @@ -834,6 +837,7 @@ impl<'a, T> Clone for Iter<'a, T> { #[stable] pub struct IterMut<'a, T: 'a> { inner: Option<&'a mut T> } +#[stable] impl<'a, T> Iterator for IterMut<'a, T> { type Item = &'a mut T; @@ -846,17 +850,20 @@ impl<'a, T> Iterator for IterMut<'a, T> { } } +#[stable] impl<'a, T> DoubleEndedIterator for IterMut<'a, T> { #[inline] fn next_back(&mut self) -> Option<&'a mut T> { self.inner.take() } } +#[stable] impl<'a, T> ExactSizeIterator for IterMut<'a, T> {} /// An iterator over the value in a `Ok` variant of a `Result`. #[stable] pub struct IntoIter { inner: Option } +#[stable] impl Iterator for IntoIter { type Item = T; @@ -869,11 +876,13 @@ impl Iterator for IntoIter { } } +#[stable] impl DoubleEndedIterator for IntoIter { #[inline] fn next_back(&mut self) -> Option { self.inner.take() } } +#[stable] impl ExactSizeIterator for IntoIter {} ///////////////////////////////////////////////////////////////////////////// diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index 8174596e65e..7161bfdcd5a 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -672,7 +672,7 @@ impl<'a, T> Default for &'a [T] { // The shared definition of the `Iter` and `IterMut` iterators macro_rules! iterator { (struct $name:ident -> $ptr:ty, $elem:ty) => { - #[experimental = "needs review"] + #[stable] impl<'a, T> Iterator for $name<'a, T> { type Item = $elem; @@ -710,7 +710,7 @@ macro_rules! iterator { } } - #[experimental = "needs review"] + #[stable] impl<'a, T> DoubleEndedIterator for $name<'a, T> { #[inline] fn next_back(&mut self) -> Option<$elem> { @@ -793,7 +793,7 @@ impl<'a,T> Copy for Iter<'a,T> {} iterator!{struct Iter -> *const T, &'a T} -#[experimental = "needs review"] +#[stable] impl<'a, T> ExactSizeIterator for Iter<'a, T> {} #[stable] @@ -801,7 +801,7 @@ impl<'a, T> Clone for Iter<'a, T> { fn clone(&self) -> Iter<'a, T> { *self } } -#[experimental = "needs review"] +#[experimental = "trait is experimental"] impl<'a, T> RandomAccessIterator for Iter<'a, T> { #[inline] fn indexable(&self) -> uint { @@ -887,7 +887,7 @@ impl<'a, T> IterMut<'a, T> { iterator!{struct IterMut -> *mut T, &'a mut T} -#[experimental = "needs review"] +#[stable] impl<'a, T> ExactSizeIterator for IterMut<'a, T> {} /// An internal abstraction over the splitting iterators, so that @@ -919,7 +919,7 @@ impl<'a, T, P> Clone for Split<'a, T, P> where P: Clone + FnMut(&T) -> bool { } } -#[experimental = "needs review"] +#[stable] impl<'a, T, P> Iterator for Split<'a, T, P> where P: FnMut(&T) -> bool { type Item = &'a [T]; @@ -947,7 +947,7 @@ impl<'a, T, P> Iterator for Split<'a, T, P> where P: FnMut(&T) -> bool { } } -#[experimental = "needs review"] +#[stable] impl<'a, T, P> DoubleEndedIterator for Split<'a, T, P> where P: FnMut(&T) -> bool { #[inline] fn next_back(&mut self) -> Option<&'a [T]> { @@ -992,7 +992,7 @@ impl<'a, T, P> SplitIter for SplitMut<'a, T, P> where P: FnMut(&T) -> bool { } } -#[experimental = "needs review"] +#[stable] impl<'a, T, P> Iterator for SplitMut<'a, T, P> where P: FnMut(&T) -> bool { type Item = &'a mut [T]; @@ -1027,7 +1027,7 @@ impl<'a, T, P> Iterator for SplitMut<'a, T, P> where P: FnMut(&T) -> bool { } } -#[experimental = "needs review"] +#[stable] impl<'a, T, P> DoubleEndedIterator for SplitMut<'a, T, P> where P: FnMut(&T) -> bool, { @@ -1060,7 +1060,6 @@ struct GenericSplitN { invert: bool } -#[experimental = "needs review"] impl> Iterator for GenericSplitN { type Item = T; @@ -1113,6 +1112,7 @@ pub struct RSplitNMut<'a, T: 'a, P> where P: FnMut(&T) -> bool { macro_rules! forward_iterator { ($name:ident: $elem:ident, $iter_of:ty) => { + #[stable] impl<'a, $elem, P> Iterator for $name<'a, $elem, P> where P: FnMut(&T) -> bool { @@ -1144,6 +1144,7 @@ pub struct Windows<'a, T:'a> { size: uint } +#[stable] impl<'a, T> Iterator for Windows<'a, T> { type Item = &'a [T]; @@ -1181,7 +1182,7 @@ pub struct Chunks<'a, T:'a> { size: uint } -#[experimental = "needs review"] +#[stable] impl<'a, T> Iterator for Chunks<'a, T> { type Item = &'a [T]; @@ -1210,7 +1211,7 @@ impl<'a, T> Iterator for Chunks<'a, T> { } } -#[experimental = "needs review"] +#[stable] impl<'a, T> DoubleEndedIterator for Chunks<'a, T> { #[inline] fn next_back(&mut self) -> Option<&'a [T]> { @@ -1226,7 +1227,7 @@ impl<'a, T> DoubleEndedIterator for Chunks<'a, T> { } } -#[experimental = "needs review"] +#[experimental = "trait is experimental"] impl<'a, T> RandomAccessIterator for Chunks<'a, T> { #[inline] fn indexable(&self) -> uint { @@ -1256,7 +1257,7 @@ pub struct ChunksMut<'a, T:'a> { chunk_size: uint } -#[experimental = "needs review"] +#[stable] impl<'a, T> Iterator for ChunksMut<'a, T> { type Item = &'a mut [T]; @@ -1286,7 +1287,7 @@ impl<'a, T> Iterator for ChunksMut<'a, T> { } } -#[experimental = "needs review"] +#[stable] impl<'a, T> DoubleEndedIterator for ChunksMut<'a, T> { #[inline] fn next_back(&mut self) -> Option<&'a mut [T]> { diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index d069744f8da..a3c6a3fe470 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -37,11 +37,8 @@ use uint; macro_rules! delegate_iter { (exact $te:ty in $ti:ty) => { delegate_iter!{$te in $ti} + #[stable] impl<'a> ExactSizeIterator for $ti { - #[inline] - fn rposition

(&mut self, predicate: P) -> Option where P: FnMut($te) -> bool{ - self.0.rposition(predicate) - } #[inline] fn len(&self) -> uint { self.0.len() @@ -49,6 +46,7 @@ macro_rules! delegate_iter { } }; ($te:ty in $ti:ty) => { + #[stable] impl<'a> Iterator for $ti { type Item = $te; @@ -61,6 +59,7 @@ macro_rules! delegate_iter { self.0.size_hint() } } + #[stable] impl<'a> DoubleEndedIterator for $ti { #[inline] fn next_back(&mut self) -> Option<$te> { @@ -69,6 +68,7 @@ macro_rules! delegate_iter { } }; (pattern $te:ty in $ti:ty) => { + #[stable] impl<'a, P: CharEq> Iterator for $ti { type Item = $te; @@ -81,6 +81,7 @@ macro_rules! delegate_iter { self.0.size_hint() } } + #[stable] impl<'a, P: CharEq> DoubleEndedIterator for $ti { #[inline] fn next_back(&mut self) -> Option<$te> { @@ -89,6 +90,7 @@ macro_rules! delegate_iter { } }; (pattern forward $te:ty in $ti:ty) => { + #[stable] impl<'a, P: CharEq> Iterator for $ti { type Item = $te; @@ -275,6 +277,7 @@ fn unwrap_or_0(opt: Option<&u8>) -> u8 { } } +#[stable] impl<'a> Iterator for Chars<'a> { type Item = char; @@ -320,6 +323,7 @@ impl<'a> Iterator for Chars<'a> { } } +#[stable] impl<'a> DoubleEndedIterator for Chars<'a> { #[inline] fn next_back(&mut self) -> Option { @@ -356,11 +360,13 @@ impl<'a> DoubleEndedIterator for Chars<'a> { /// External iterator for a string's characters and their byte offsets. /// Use with the `std::iter` module. #[derive(Clone)] +#[stable] pub struct CharIndices<'a> { front_offset: uint, iter: Chars<'a>, } +#[stable] impl<'a> Iterator for CharIndices<'a> { type Item = (uint, char); @@ -384,6 +390,7 @@ impl<'a> Iterator for CharIndices<'a> { } } +#[stable] impl<'a> DoubleEndedIterator for CharIndices<'a> { #[inline] fn next_back(&mut self) -> Option<(uint, char)> { @@ -465,6 +472,7 @@ impl<'a, Sep> CharSplits<'a, Sep> { } } +#[stable] impl<'a, Sep: CharEq> Iterator for CharSplits<'a, Sep> { type Item = &'a str; @@ -499,6 +507,7 @@ impl<'a, Sep: CharEq> Iterator for CharSplits<'a, Sep> { } } +#[stable] impl<'a, Sep: CharEq> DoubleEndedIterator for CharSplits<'a, Sep> { #[inline] fn next_back(&mut self) -> Option<&'a str> { @@ -540,6 +549,7 @@ impl<'a, Sep: CharEq> DoubleEndedIterator for CharSplits<'a, Sep> { } } +#[stable] impl<'a, Sep: CharEq> Iterator for CharSplitsN<'a, Sep> { type Item = &'a str; @@ -865,6 +875,7 @@ pub struct SplitStr<'a> { finished: bool } +#[stable] impl<'a> Iterator for MatchIndices<'a> { type Item = (uint, uint); @@ -881,6 +892,7 @@ impl<'a> Iterator for MatchIndices<'a> { } } +#[stable] impl<'a> Iterator for SplitStr<'a> { type Item = &'a str; @@ -1586,6 +1598,7 @@ impl<'a> Default for &'a str { fn default() -> &'a str { "" } } +#[stable] impl<'a> Iterator for Lines<'a> { type Item = &'a str; @@ -1593,11 +1606,13 @@ impl<'a> Iterator for Lines<'a> { fn next(&mut self) -> Option<&'a str> { self.inner.next() } #[inline] fn size_hint(&self) -> (uint, Option) { self.inner.size_hint() } -} + +#[stable]} impl<'a> DoubleEndedIterator for Lines<'a> { #[inline] fn next_back(&mut self) -> Option<&'a str> { self.inner.next_back() } -} + +#[stable]} impl<'a> Iterator for LinesAny<'a> { type Item = &'a str; @@ -1605,7 +1620,8 @@ impl<'a> Iterator for LinesAny<'a> { fn next(&mut self) -> Option<&'a str> { self.inner.next() } #[inline] fn size_hint(&self) -> (uint, Option) { self.inner.size_hint() } -} + +#[stable]} impl<'a> DoubleEndedIterator for LinesAny<'a> { #[inline] fn next_back(&mut self) -> Option<&'a str> { self.inner.next_back() } diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index b1824db93aa..c44d6c34cd9 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -18,7 +18,7 @@ use default::Default; use fmt::Show; use fmt; use hash::{Hash, Hasher, RandomSipHasher}; -use iter::{Iterator, IteratorExt, IteratorCloneExt, FromIterator, Map, Chain, Extend}; +use iter::{Iterator, IteratorExt, FromIterator, Map, Chain, Extend}; use ops::{BitOr, BitAnd, BitXor, Sub}; use option::Option::{Some, None, self}; use result::Result::{Ok, Err}; diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index c56acd38e81..c4e37264e2a 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -14,7 +14,7 @@ use cmp; use io::{Reader, Writer, Stream, Buffer, DEFAULT_BUF_SIZE, IoResult}; -use iter::ExactSizeIterator; +use iter::{IteratorExt, ExactSizeIterator}; use ops::Drop; use option::Option; use option::Option::{Some, None}; diff --git a/src/libstd/prelude/v1.rs b/src/libstd/prelude/v1.rs index f6bdcd53dff..9e9a483e1a5 100644 --- a/src/libstd/prelude/v1.rs +++ b/src/libstd/prelude/v1.rs @@ -25,11 +25,9 @@ #[stable] #[doc(no_inline)] pub use char::CharExt; #[stable] #[doc(no_inline)] pub use clone::Clone; #[stable] #[doc(no_inline)] pub use cmp::{PartialEq, PartialOrd, Eq, Ord}; -#[stable] #[doc(no_inline)] pub use iter::CloneIteratorExt; #[stable] #[doc(no_inline)] pub use iter::DoubleEndedIterator; #[stable] #[doc(no_inline)] pub use iter::ExactSizeIterator; #[stable] #[doc(no_inline)] pub use iter::{Iterator, IteratorExt, Extend}; -#[stable] #[doc(no_inline)] pub use iter::{IteratorCloneExt, IteratorOrdExt}; #[stable] #[doc(no_inline)] pub use option::Option::{self, Some, None}; #[stable] #[doc(no_inline)] pub use ptr::{PtrExt, MutPtrExt}; #[stable] #[doc(no_inline)] pub use result::Result::{self, Ok, Err}; diff --git a/src/libstd/sync/condvar.rs b/src/libstd/sync/condvar.rs index 7734f655ed2..e97be51fdbc 100644 --- a/src/libstd/sync/condvar.rs +++ b/src/libstd/sync/condvar.rs @@ -188,6 +188,7 @@ impl Condvar { pub fn notify_all(&self) { unsafe { self.inner.inner.notify_all() } } } +#[stable] impl Drop for Condvar { fn drop(&mut self) { unsafe { self.inner.inner.destroy() } diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs index 6bc3f561bb3..09ff8f440f3 100644 --- a/src/libstd/sync/mpsc/mod.rs +++ b/src/libstd/sync/mpsc/mod.rs @@ -657,6 +657,7 @@ impl Clone for Sender { } #[unsafe_destructor] +#[stable] impl Drop for Sender { fn drop(&mut self) { match *unsafe { self.inner_mut() } { @@ -720,6 +721,7 @@ impl Clone for SyncSender { } #[unsafe_destructor] +#[stable] impl Drop for SyncSender { fn drop(&mut self) { unsafe { (*self.inner.get()).drop_chan(); } @@ -935,7 +937,7 @@ impl select::Packet for Receiver { } } -#[unstable] +#[stable] impl<'a, T: Send> Iterator for Iter<'a, T> { type Item = T; @@ -943,6 +945,7 @@ impl<'a, T: Send> Iterator for Iter<'a, T> { } #[unsafe_destructor] +#[stable] impl Drop for Receiver { fn drop(&mut self) { match *unsafe { self.inner_mut() } { diff --git a/src/libstd/sync/mpsc/mpsc_queue.rs b/src/libstd/sync/mpsc/mpsc_queue.rs index 8f85dc6e043..9ad24a5a11e 100644 --- a/src/libstd/sync/mpsc/mpsc_queue.rs +++ b/src/libstd/sync/mpsc/mpsc_queue.rs @@ -138,6 +138,7 @@ impl Queue { } #[unsafe_destructor] +#[stable] impl Drop for Queue { fn drop(&mut self) { unsafe { diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index b158bd69c7b..6b3dd89f33b 100644 --- a/src/libstd/sync/mutex.rs +++ b/src/libstd/sync/mutex.rs @@ -228,6 +228,7 @@ impl Mutex { } #[unsafe_destructor] +#[stable] impl Drop for Mutex { fn drop(&mut self) { // This is actually safe b/c we know that there is no further usage of @@ -291,6 +292,7 @@ impl<'mutex, T> MutexGuard<'mutex, T> { } } +#[stable] impl<'mutex, T> Deref for MutexGuard<'mutex, T> { type Target = T; @@ -298,6 +300,7 @@ impl<'mutex, T> Deref for MutexGuard<'mutex, T> { unsafe { &*self.__data.get() } } } +#[stable] impl<'mutex, T> DerefMut for MutexGuard<'mutex, T> { fn deref_mut<'a>(&'a mut self) -> &'a mut T { unsafe { &mut *self.__data.get() } @@ -305,6 +308,7 @@ impl<'mutex, T> DerefMut for MutexGuard<'mutex, T> { } #[unsafe_destructor] +#[stable] impl<'a, T> Drop for MutexGuard<'a, T> { #[inline] fn drop(&mut self) { diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index b2367ff8352..c8ca1b02aab 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -228,6 +228,7 @@ impl RWLock { } #[unsafe_destructor] +#[stable] impl Drop for RWLock { fn drop(&mut self) { unsafe { self.inner.lock.destroy() } @@ -327,16 +328,19 @@ impl<'rwlock, T> RWLockWriteGuard<'rwlock, T> { } } +#[stable] impl<'rwlock, T> Deref for RWLockReadGuard<'rwlock, T> { type Target = T; fn deref(&self) -> &T { unsafe { &*self.__data.get() } } } +#[stable] impl<'rwlock, T> Deref for RWLockWriteGuard<'rwlock, T> { type Target = T; fn deref(&self) -> &T { unsafe { &*self.__data.get() } } } +#[stable] impl<'rwlock, T> DerefMut for RWLockWriteGuard<'rwlock, T> { fn deref_mut(&mut self) -> &mut T { unsafe { &mut *self.__data.get() } @@ -344,6 +348,7 @@ impl<'rwlock, T> DerefMut for RWLockWriteGuard<'rwlock, T> { } #[unsafe_destructor] +#[stable] impl<'a, T> Drop for RWLockReadGuard<'a, T> { fn drop(&mut self) { unsafe { self.__lock.lock.read_unlock(); } @@ -351,6 +356,7 @@ impl<'a, T> Drop for RWLockReadGuard<'a, T> { } #[unsafe_destructor] +#[stable] impl<'a, T> Drop for RWLockWriteGuard<'a, T> { fn drop(&mut self) { self.__lock.poison.done(&self.__poison); diff --git a/src/libstd/sync/semaphore.rs b/src/libstd/sync/semaphore.rs index c0ff674ba0f..505819fbf8a 100644 --- a/src/libstd/sync/semaphore.rs +++ b/src/libstd/sync/semaphore.rs @@ -99,6 +99,7 @@ impl Semaphore { } #[unsafe_destructor] +#[stable] impl<'a> Drop for SemaphoreGuard<'a> { fn drop(&mut self) { self.sem.release(); diff --git a/src/libstd/thread.rs b/src/libstd/thread.rs index 63112327415..cc82d38ae2a 100644 --- a/src/libstd/thread.rs +++ b/src/libstd/thread.rs @@ -423,6 +423,7 @@ impl JoinGuard { } #[unsafe_destructor] +#[stable] impl Drop for JoinGuard { fn drop(&mut self) { if !self.joined {