about summary refs log tree commit diff
path: root/src/libcollections
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-01-05 18:41:20 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-01-05 18:41:20 -0800
commit2e883a5f5310a257d6ff8a0d886737d7dc1e7ae4 (patch)
treed4d000e33b01feac0d57cd018e8ceddc6a403154 /src/libcollections
parentbb5e16b4b869f0c585c21db110e51165865e8833 (diff)
parentc6f4a03d12d97162e2775c14ab006d355b04126d (diff)
downloadrust-2e883a5f5310a257d6ff8a0d886737d7dc1e7ae4.tar.gz
rust-2e883a5f5310a257d6ff8a0d886737d7dc1e7ae4.zip
rollup merge of #20560: aturon/stab-2-iter-ops-slice
Conflicts:
	src/libcollections/slice.rs
	src/libcore/iter.rs
	src/libstd/sync/mpsc/mod.rs
	src/libstd/sync/rwlock.rs
Diffstat (limited to 'src/libcollections')
-rw-r--r--src/libcollections/binary_heap.rs5
-rw-r--r--src/libcollections/dlist.rs2
-rw-r--r--src/libcollections/lib.rs7
-rw-r--r--src/libcollections/ring_buf.rs2
-rw-r--r--src/libcollections/slice.rs18
-rw-r--r--src/libcollections/str.rs6
-rw-r--r--src/libcollections/string.rs8
-rw-r--r--src/libcollections/vec.rs19
8 files changed, 52 insertions, 15 deletions
diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs
index 82002f16133..d95c666b586 100644
--- a/src/libcollections/binary_heap.rs
+++ b/src/libcollections/binary_heap.rs
@@ -148,6 +148,7 @@
 //! ```
 
 #![allow(missing_docs)]
+#![stable]
 
 use core::prelude::*;
 
@@ -561,11 +562,13 @@ impl<T: Ord> BinaryHeap<T> {
 }
 
 /// `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() }
@@ -593,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<T> {
     iter: vec::IntoIter<T>,
 }
@@ -618,6 +622,7 @@ impl<T> DoubleEndedIterator for IntoIter<T> {
 impl<T> ExactSizeIterator for IntoIter<T> {}
 
 /// 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/dlist.rs b/src/libcollections/dlist.rs
index 5aec9973c81..b3c1486eaf3 100644
--- a/src/libcollections/dlist.rs
+++ b/src/libcollections/dlist.rs
@@ -19,6 +19,8 @@
 // Backlinks over DList::prev are raw pointers that form a full chain in
 // the reverse direction.
 
+#![stable]
+
 use core::prelude::*;
 
 use alloc::boxed::Box;
diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs
index db236795038..c9b090bfb23 100644
--- a/src/libcollections/lib.rs
+++ b/src/libcollections/lib.rs
@@ -65,19 +65,23 @@ pub mod string;
 pub mod vec;
 pub mod vec_map;
 
+#[stable]
 pub mod bitv {
     pub use bit::{Bitv, Iter};
 }
 
+#[stable]
 pub mod bitv_set {
     pub use bit::{BitvSet, Union, Intersection, Difference, SymmetricDifference};
     pub use bit::SetIter as Iter;
 }
 
+#[stable]
 pub mod btree_map {
     pub use btree::map::*;
 }
 
+#[stable]
 pub mod btree_set {
     pub use btree::set::*;
 }
@@ -109,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/ring_buf.rs b/src/libcollections/ring_buf.rs
index 8a83bf25e9b..0ffede776ea 100644
--- a/src/libcollections/ring_buf.rs
+++ b/src/libcollections/ring_buf.rs
@@ -12,6 +12,8 @@
 //! ends of the container. It also has `O(1)` indexing like a vector. The contained elements are
 //! not required to be copyable, and the queue will be sendable if the contained type is sendable.
 
+#![stable]
+
 use core::prelude::*;
 
 use core::cmp::Ordering;
diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs
index 8050c44f542..1afdd8c023b 100644
--- a/src/libcollections/slice.rs
+++ b/src/libcollections/slice.rs
@@ -86,6 +86,7 @@
 //! * Further iterators exist that split, chunk or permute the slice.
 
 #![doc(primitive = "slice")]
+#![stable]
 
 use alloc::boxed::Box;
 use core::borrow::{BorrowFrom, BorrowFromMut, ToOwned};
@@ -121,8 +122,10 @@ pub type MutItems<'a, T:'a> = IterMut<'a, T>;
 ////////////////////////////////////////////////////////////////////////////////
 
 /// Allocating extension methods for slices.
-#[unstable = "needs associated types, may merge with other traits"]
-pub trait SliceExt<T> for Sized? {
+pub trait SliceExt for Sized? {
+    #[stable]
+    type Item;
+
     /// Sorts the slice, in place, using `compare` to compare
     /// elements.
     ///
@@ -561,8 +564,10 @@ pub trait SliceExt<T> for Sized? {
     fn as_mut_ptr(&mut self) -> *mut T;
 }
 
-#[unstable = "trait is unstable"]
-impl<T> SliceExt<T> for [T] {
+#[stable]
+impl<T> SliceExt for [T] {
+    type Item = T;
+
     #[inline]
     fn sort_by<F>(&mut self, compare: F) where F: FnMut(&T, &T) -> Ordering {
         merge_sort(self, compare)
@@ -1113,7 +1118,10 @@ struct SizeDirection {
     dir: Direction,
 }
 
-impl Iterator<(uint, uint)> for ElementSwaps {
+#[stable]
+impl Iterator for ElementSwaps {
+    type Item = (uint, uint);
+
     #[inline]
     fn next(&mut self) -> Option<(uint, uint)> {
         fn new_pos(i: uint, s: Direction) -> 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<u8>
 }
 
+#[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<Chars<'a>>
 }
 
+#[stable]
 impl<'a> Iterator for Utf16Units<'a> {
     type Item = u16;
 
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs
index 11e6c48cfdb..6d7ebeff094 100644
--- a/src/libcollections/string.rs
+++ b/src/libcollections/string.rs
@@ -687,7 +687,7 @@ impl fmt::Show for FromUtf16Error {
     }
 }
 
-#[experimental = "waiting on FromIterator stabilization"]
+#[stable]
 impl FromIterator<char> for String {
     fn from_iter<I:Iterator<Item=char>>(iterator: I) -> String {
         let mut buf = String::new();
@@ -696,7 +696,7 @@ impl FromIterator<char> for String {
     }
 }
 
-#[experimental = "waiting on FromIterator stabilization"]
+#[stable]
 impl<'a> FromIterator<&'a str> for String {
     fn from_iter<I:Iterator<Item=&'a str>>(iterator: I) -> String {
         let mut buf = String::new();
@@ -808,7 +808,7 @@ impl<H: hash::Writer> hash::Hash<H> for String {
     }
 }
 
-#[experimental = "waiting on Add stabilization"]
+#[unstable = "recent addition, needs more experience"]
 impl<'a> Add<&'a str> for String {
     type Output = String;
 
@@ -840,7 +840,7 @@ impl ops::Slice<uint, str> 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 e0ed8e27e99..86f5f61b210 100644
--- a/src/libcollections/vec.rs
+++ b/src/libcollections/vec.rs
@@ -1251,19 +1251,19 @@ impl<T> ops::SliceMut<uint, [T]> for Vec<T> {
     }
 }
 
-#[experimental = "waiting on Deref stability"]
+#[stable]
 impl<T> ops::Deref for Vec<T> {
     type Target = [T];
 
     fn deref<'a>(&'a self) -> &'a [T] { self.as_slice() }
 }
 
-#[experimental = "waiting on DerefMut stability"]
+#[stable]
 impl<T> ops::DerefMut for Vec<T> {
     fn deref_mut<'a>(&'a mut self) -> &'a mut [T] { self.as_mut_slice() }
 }
 
-#[experimental = "waiting on FromIterator stability"]
+#[stable]
 impl<T> FromIterator<T> for Vec<T> {
     #[inline]
     fn from_iter<I:Iterator<Item=T>>(mut iterator: I) -> Vec<T> {
@@ -1393,6 +1393,7 @@ impl<T> AsSlice<T> for Vec<T> {
     }
 }
 
+#[unstable = "recent addition, needs more experience"]
 impl<'a, T: Clone> Add<&'a [T]> for Vec<T> {
     type Output = Vec<T>;
 
@@ -1404,6 +1405,7 @@ impl<'a, T: Clone> Add<&'a [T]> for Vec<T> {
 }
 
 #[unsafe_destructor]
+#[stable]
 impl<T> Drop for Vec<T> {
     fn drop(&mut self) {
         // This is (and should always remain) a no-op if the fields are
@@ -1449,6 +1451,7 @@ impl<'a> fmt::Writer for Vec<u8> {
 /// A clone-on-write vector
 pub type CowVec<'a, T> = Cow<'a, Vec<T>, [T]>;
 
+#[unstable]
 impl<'a, T> FromIterator<T> for CowVec<'a, T> where T: Clone {
     fn from_iter<I: Iterator<Item=T>>(it: I) -> CowVec<'a, T> {
         Cow::Owned(FromIterator::from_iter(it))
@@ -1494,6 +1497,7 @@ impl<T> IntoIter<T> {
     }
 }
 
+#[stable]
 impl<T> Iterator for IntoIter<T> {
     type Item = T;
 
@@ -1530,6 +1534,7 @@ impl<T> Iterator for IntoIter<T> {
     }
 }
 
+#[stable]
 impl<T> DoubleEndedIterator for IntoIter<T> {
     #[inline]
     fn next_back<'a>(&'a mut self) -> Option<T> {
@@ -1553,9 +1558,11 @@ impl<T> DoubleEndedIterator for IntoIter<T> {
     }
 }
 
+#[stable]
 impl<T> ExactSizeIterator for IntoIter<T> {}
 
 #[unsafe_destructor]
+#[stable]
 impl<T> Drop for IntoIter<T> {
     fn drop(&mut self) {
         // destroy the remaining elements
@@ -1577,6 +1584,7 @@ pub struct Drain<'a, T> {
     marker: ContravariantLifetime<'a>,
 }
 
+#[stable]
 impl<'a, T> Iterator for Drain<'a, T> {
     type Item = T;
 
@@ -1613,6 +1621,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<T> {
@@ -1636,9 +1645,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,
@@ -1671,7 +1682,7 @@ impl<'a, T> Deref for DerefVec<'a, T> {
 
 // Prevent the inner `Vec<T>` 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;