Skip to content

Commit

Permalink
Stabilization of impls and fallout from stabilization
Browse files Browse the repository at this point in the history
  • Loading branch information
aturon committed Jan 5, 2015
1 parent cb765ce commit c6f4a03
Show file tree
Hide file tree
Showing 29 changed files with 128 additions and 49 deletions.
6 changes: 3 additions & 3 deletions src/liballoc/arc.rs
Expand Up @@ -246,7 +246,7 @@ impl<T> BorrowFrom<Arc<T>> for T {
}
}

#[experimental = "Deref is experimental."]
#[stable]
impl<T> Deref for Arc<T> {
type Target = T;

Expand Down Expand Up @@ -290,7 +290,7 @@ impl<T: Send + Sync + Clone> Arc<T> {
}

#[unsafe_destructor]
#[experimental = "waiting on stability of Drop"]
#[stable]
impl<T: Sync + Send> Drop for Arc<T> {
/// Drops the `Arc<T>`.
///
Expand Down Expand Up @@ -418,7 +418,7 @@ impl<T: Sync + Send> Clone for Weak<T> {
}

#[unsafe_destructor]
#[experimental = "Weak pointers may not belong in this module."]
#[stable]
impl<T: Sync + Send> Drop for Weak<T> {
/// Drops the `Weak<T>`.
///
Expand Down
2 changes: 2 additions & 0 deletions src/liballoc/boxed.rs
Expand Up @@ -155,12 +155,14 @@ impl fmt::Show for Box<Any> {
}
}

#[stable]
impl<Sized? T> Deref for Box<T> {
type Target = T;

fn deref(&self) -> &T { &**self }
}

#[stable]
impl<Sized? T> DerefMut for Box<T> {
fn deref_mut(&mut self) -> &mut T { &mut **self }
}
Expand Down
6 changes: 3 additions & 3 deletions src/liballoc/rc.rs
Expand Up @@ -354,7 +354,7 @@ impl<T> BorrowFrom<Rc<T>> for T {
}
}

#[experimental = "Deref is experimental."]
#[stable]
impl<T> Deref for Rc<T> {
type Target = T;

Expand All @@ -365,7 +365,7 @@ impl<T> Deref for Rc<T> {
}

#[unsafe_destructor]
#[experimental = "Drop is experimental."]
#[stable]
impl<T> Drop for Rc<T> {
/// Drops the `Rc<T>`.
///
Expand Down Expand Up @@ -656,7 +656,7 @@ impl<T> Weak<T> {
}

#[unsafe_destructor]
#[experimental = "Weak pointers may not belong in this module."]
#[stable]
impl<T> Drop for Weak<T> {
/// Drops the `Weak<T>`.
///
Expand Down
4 changes: 4 additions & 0 deletions src/libcollections/binary_heap.rs
Expand Up @@ -562,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() }
Expand Down Expand Up @@ -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<T> {
iter: vec::IntoIter<T>,
}
Expand All @@ -619,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>,
}
Expand Down
3 changes: 1 addition & 2 deletions src/libcollections/lib.rs
Expand Up @@ -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};
Expand Down
1 change: 1 addition & 0 deletions src/libcollections/slice.rs
Expand Up @@ -1092,6 +1092,7 @@ struct SizeDirection {
dir: Direction,
}

#[stable]
impl Iterator for ElementSwaps {
type Item = (uint, uint);

Expand Down
6 changes: 6 additions & 0 deletions src/libcollections/str.rs
Expand Up @@ -165,13 +165,15 @@ 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>,
buffer: Vec<(char, u8)>,
sorted: bool
}

#[stable]
impl<'a> Iterator for Decompositions<'a> {
type Item = char;

Expand Down Expand Up @@ -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,
Expand All @@ -261,6 +264,7 @@ pub struct Recompositions<'a> {
last_ccc: Option<u8>
}

#[stable]
impl<'a> Iterator for Recompositions<'a> {
type Item = char;

Expand Down Expand Up @@ -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;

Expand Down
8 changes: 4 additions & 4 deletions src/libcollections/string.rs
Expand Up @@ -711,7 +711,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();
Expand All @@ -720,7 +720,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();
Expand Down Expand Up @@ -832,7 +832,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;

Expand Down Expand Up @@ -864,7 +864,7 @@ impl ops::Slice<uint, str> for String {
}
}

#[experimental = "waiting on Deref stabilization"]
#[stable]
impl ops::Deref for String {
type Target = str;

Expand Down
19 changes: 15 additions & 4 deletions src/libcollections/vec.rs
Expand Up @@ -1272,19 +1272,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> {
Expand Down Expand Up @@ -1414,6 +1414,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>;

Expand All @@ -1425,6 +1426,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
Expand Down Expand Up @@ -1470,6 +1472,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))
Expand Down Expand Up @@ -1515,6 +1518,7 @@ impl<T> IntoIter<T> {
}
}

#[stable]
impl<T> Iterator for IntoIter<T> {
type Item = T;

Expand Down Expand Up @@ -1551,6 +1555,7 @@ impl<T> Iterator for IntoIter<T> {
}
}

#[stable]
impl<T> DoubleEndedIterator for IntoIter<T> {
#[inline]
fn next_back<'a>(&'a mut self) -> Option<T> {
Expand All @@ -1574,9 +1579,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
Expand All @@ -1598,6 +1605,7 @@ pub struct Drain<'a, T> {
marker: ContravariantLifetime<'a>,
}

#[stable]
impl<'a, T> Iterator for Drain<'a, T> {
type Item = T;

Expand Down Expand Up @@ -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<T> {
Expand All @@ -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,
Expand Down Expand Up @@ -1692,7 +1703,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;
Expand Down
1 change: 1 addition & 0 deletions src/libcore/borrow.rs
Expand Up @@ -191,6 +191,7 @@ impl<'a, T, Sized? B> Cow<'a, T, B> where B: ToOwned<T> {
}
}

#[stable]
impl<'a, T, Sized? B> Deref for Cow<'a, T, B> where B: ToOwned<T> {
type Target = B;

Expand Down
6 changes: 3 additions & 3 deletions src/libcore/cell.rs
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand All @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions src/libcore/char.rs
Expand Up @@ -314,6 +314,7 @@ pub struct EscapeUnicode {
}

#[derive(Clone)]
#[unstable]
enum EscapeUnicodeState {
Backslash,
Type,
Expand Down Expand Up @@ -375,6 +376,7 @@ pub struct EscapeDefault {
}

#[derive(Clone)]
#[unstable]
enum EscapeDefaultState {
Backslash(char),
Char(char),
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/iter.rs
Expand Up @@ -2401,7 +2401,7 @@ impl<A, St, F> Unfold<A, St, F> where F: FnMut(&mut St) -> Option<A> {
}
}

#[experimental]
#[stable]
impl<A, St, F> Iterator for Unfold<A, St, F> where F: FnMut(&mut St) -> Option<A> {
type Item = A;

Expand Down

0 comments on commit c6f4a03

Please sign in to comment.