diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index e909947ab08..c3bd5c4157c 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -132,7 +132,7 @@ pub fn weak_count(this: &Arc) -> uint { this.inner().weak.load(atomic::Seq #[experimental] pub fn strong_count(this: &Arc) -> uint { this.inner().strong.load(atomic::SeqCst) } -#[unstable = "waiting on stability of Clone"] +#[stable] impl Clone for Arc { /// Duplicate an atomically reference counted wrapper. /// diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 879a8cc6951..f0c96196b78 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -57,7 +57,7 @@ impl Default for Box<[T]> { fn default() -> Box<[T]> { box [] } } -#[unstable] +#[stable] impl Clone for Box { /// Returns a copy of the owned box. #[inline] diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 0257c640d3c..b22c366e29d 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -413,7 +413,7 @@ impl Drop for Rc { } } -#[unstable = "Clone is unstable."] +#[stable] impl Clone for Rc { /// Makes a clone of the `Rc`. /// diff --git a/src/libcollections/bit.rs b/src/libcollections/bit.rs index 7f78d56607e..2025af1286b 100644 --- a/src/libcollections/bit.rs +++ b/src/libcollections/bit.rs @@ -851,6 +851,7 @@ impl Extend for Bitv { } } +#[stable] impl Clone for Bitv { #[inline] fn clone(&self) -> Bitv { diff --git a/src/libcollections/btree/node.rs b/src/libcollections/btree/node.rs index 9698b06c7fa..56b544c4087 100644 --- a/src/libcollections/btree/node.rs +++ b/src/libcollections/btree/node.rs @@ -390,6 +390,7 @@ impl Node { } // FIXME(gereeter) Write an efficient clone_from +#[stable] impl Clone for Node { fn clone(&self) -> Node { let mut ret = if self.is_leaf() { diff --git a/src/libcollections/dlist.rs b/src/libcollections/dlist.rs index e7454aef51e..04bd40bf51a 100644 --- a/src/libcollections/dlist.rs +++ b/src/libcollections/dlist.rs @@ -758,6 +758,7 @@ impl Ord for DList { } } +#[stable] impl Clone for DList { fn clone(&self) -> DList { self.iter().map(|x| x.clone()).collect() diff --git a/src/libcollections/ring_buf.rs b/src/libcollections/ring_buf.rs index cdb92d302e9..5d53520b8f3 100644 --- a/src/libcollections/ring_buf.rs +++ b/src/libcollections/ring_buf.rs @@ -48,6 +48,7 @@ pub struct RingBuf { ptr: *mut T } +#[stable] impl Clone for RingBuf { fn clone(&self) -> RingBuf { self.iter().map(|t| t.clone()).collect() diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index e986b204430..7fca8b37705 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -443,7 +443,7 @@ impl Vec { } } -#[unstable] +#[stable] impl Clone for Vec { fn clone(&self) -> Vec { self.as_slice().to_vec() } diff --git a/src/libcore/array.rs b/src/libcore/array.rs index ffaf35414ea..e85a132ed36 100644 --- a/src/libcore/array.rs +++ b/src/libcore/array.rs @@ -25,7 +25,7 @@ use option::Option; macro_rules! array_impls { ($($N:expr)+) => { $( - #[unstable = "waiting for Clone to stabilize"] + #[stable] impl Clone for [T, ..$N] { fn clone(&self) -> [T, ..$N] { *self @@ -115,4 +115,3 @@ array_impls! { 20 21 22 23 24 25 26 27 28 29 30 31 32 } - diff --git a/src/libcore/borrow.rs b/src/libcore/borrow.rs index b44b87bd938..9bbcf67773e 100644 --- a/src/libcore/borrow.rs +++ b/src/libcore/borrow.rs @@ -137,6 +137,7 @@ pub enum Cow<'a, T, Sized? B: 'a> where B: ToOwned { Owned(T) } +#[stable] impl<'a, T, Sized? B> Clone for Cow<'a, T, B> where B: ToOwned { fn clone(&self) -> Cow<'a, T, B> { match *self { diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index 01979e97577..e0041f9738e 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -208,7 +208,7 @@ impl Cell { } } -#[unstable = "waiting for `Clone` trait to become stable"] +#[stable] impl Clone for Cell { fn clone(&self) -> Cell { Cell::new(self.get()) @@ -341,7 +341,7 @@ impl RefCell { } } -#[unstable = "waiting for `Clone` to become stable"] +#[stable] impl Clone for RefCell { fn clone(&self) -> RefCell { RefCell::new(self.borrow().clone()) diff --git a/src/libcore/clone.rs b/src/libcore/clone.rs index f6be422813a..686ccf6f1a2 100644 --- a/src/libcore/clone.rs +++ b/src/libcore/clone.rs @@ -19,13 +19,15 @@ //! explicitly, by convention implementing the `Clone` trait and calling //! the `clone` method. -#![unstable] +#![stable] use kinds::Sized; /// A common trait for cloning an object. +#[stable] pub trait Clone { /// Returns a copy of the value. + #[stable] fn clone(&self) -> Self; /// Perform copy-assignment from `source`. @@ -34,12 +36,13 @@ pub trait Clone { /// but can be overridden to reuse the resources of `a` to avoid unnecessary /// allocations. #[inline(always)] - #[experimental = "this function is mostly unused"] + #[unstable = "this function rarely unused"] fn clone_from(&mut self, source: &Self) { *self = source.clone() } } +#[stable] impl<'a, Sized? T> Clone for &'a T { /// Return a shallow copy of the reference. #[inline] @@ -48,6 +51,7 @@ impl<'a, Sized? T> Clone for &'a T { macro_rules! clone_impl { ($t:ty) => { + #[stable] impl Clone for $t { /// Return a deep copy of the value. #[inline] @@ -95,4 +99,3 @@ extern_fn_clone! { A, B, C, D, E } extern_fn_clone! { A, B, C, D, E, F } extern_fn_clone! { A, B, C, D, E, F, G } extern_fn_clone! { A, B, C, D, E, F, G, H } - diff --git a/src/libcore/hash/sip.rs b/src/libcore/hash/sip.rs index e10f5a9fed1..628c1897f6e 100644 --- a/src/libcore/hash/sip.rs +++ b/src/libcore/hash/sip.rs @@ -195,6 +195,7 @@ impl Writer for SipState { } } +#[stable] impl Clone for SipState { #[inline] fn clone(&self) -> SipState { diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 1f83aad9c7c..b592d1db274 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -1386,6 +1386,7 @@ pub struct Map, F: FnMut(A) -> B> { } // FIXME(#19839) Remove in favor of `#[deriving(Clone)]` +#[stable] impl Clone for Map where I: Clone + Iterator, F: Clone + FnMut(A) -> B, @@ -1460,6 +1461,7 @@ pub struct Filter where I: Iterator, P: FnMut(&A) -> bool { } // FIXME(#19839) Remove in favor of `#[deriving(Clone)]` +#[stable] impl Clone for Filter where I: Clone + Iterator, P: Clone + FnMut(&A) -> bool, @@ -1518,6 +1520,7 @@ pub struct FilterMap where I: Iterator, F: FnMut(A) -> Option } // FIXME(#19839) Remove in favor of `#[deriving(Clone)]` +#[stable] impl Clone for FilterMap where I: Clone + Iterator, F: Clone + FnMut(A) -> Option, @@ -1693,6 +1696,7 @@ pub struct SkipWhile where I: Iterator, P: FnMut(&A) -> bool { } // FIXME(#19839) Remove in favor of `#[deriving(Clone)]` +#[stable] impl Clone for SkipWhile where I: Clone + Iterator, P: Clone + FnMut(&A) -> bool, @@ -1736,6 +1740,7 @@ pub struct TakeWhile where I: Iterator, P: FnMut(&A) -> bool { } // FIXME(#19839) Remove in favor of `#[deriving(Clone)]` +#[stable] impl Clone for TakeWhile where I: Clone + Iterator, P: Clone + FnMut(&A) -> bool, @@ -1911,6 +1916,7 @@ pub struct Scan where I: Iterator, F: FnMut(&mut St, A) -> Op } // FIXME(#19839) Remove in favor of `#[deriving(Clone)]` +#[stable] impl Clone for Scan where I: Clone + Iterator, St: Clone, @@ -1955,6 +1961,7 @@ pub struct FlatMap where I: Iterator, U: Iterator, F: FnMut } // FIXME(#19839) Remove in favor of `#[deriving(Clone)]` +#[stable] impl Clone for FlatMap where I: Clone + Iterator, U: Clone + Iterator, @@ -2115,6 +2122,7 @@ pub struct Inspect where I: Iterator, F: FnMut(&A) { } // FIXME(#19839) Remove in favor of `#[deriving(Clone)]` +#[stable] impl Clone for Inspect where I: Clone + Iterator, F: Clone + FnMut(&A), @@ -2222,6 +2230,7 @@ pub struct Unfold where F: FnMut(&mut St) -> Option { } // FIXME(#19839) Remove in favor of `#[deriving(Clone)]` +#[stable] impl Clone for Unfold where F: Clone + FnMut(&mut St) -> Option, St: Clone, diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 314b47fc647..8adbba8b94b 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -819,6 +819,7 @@ impl<'a, A> DoubleEndedIterator<&'a A> for Iter<'a, A> { impl<'a, A> ExactSizeIterator<&'a A> for Iter<'a, A> {} +#[stable] impl<'a, A> Clone for Iter<'a, A> { fn clone(&self) -> Iter<'a, A> { Iter { inner: self.inner.clone() } diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 36c6b9572ea..1726a753792 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -340,6 +340,7 @@ impl Equiv<*const T> for *mut T { } } +#[stable] impl Clone for *const T { #[inline] fn clone(&self) -> *const T { @@ -347,6 +348,7 @@ impl Clone for *const T { } } +#[stable] impl Clone for *mut T { #[inline] fn clone(&self) -> *mut T { @@ -451,4 +453,3 @@ impl PartialOrd for *mut T { #[inline] fn ge(&self, other: &*mut T) -> bool { *self >= *other } } - diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index f5d117bca9f..efc92429afd 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -781,7 +781,7 @@ iterator!{struct Items -> *const T, &'a T} #[experimental = "needs review"] impl<'a, T> ExactSizeIterator<&'a T> for Items<'a, T> {} -#[experimental = "needs review"] +#[stable] impl<'a, T> Clone for Items<'a, T> { fn clone(&self) -> Items<'a, T> { *self } } @@ -893,6 +893,7 @@ pub struct Splits<'a, T:'a, P> where P: FnMut(&T) -> bool { } // FIXME(#19839) Remove in favor of `#[deriving(Clone)]` +#[stable] impl<'a, T, P> Clone for Splits<'a, T, P> where P: Clone + FnMut(&T) -> bool { fn clone(&self) -> Splits<'a, T, P> { Splits { @@ -1550,4 +1551,3 @@ impl_int_slice! { u16, i16 } impl_int_slice! { u32, i32 } impl_int_slice! { u64, i64 } impl_int_slice! { uint, int } - diff --git a/src/libcore/tuple/mod.rs b/src/libcore/tuple/mod.rs index 5ea84f7db91..1a82109be5b 100644 --- a/src/libcore/tuple/mod.rs +++ b/src/libcore/tuple/mod.rs @@ -126,7 +126,7 @@ macro_rules! tuple_impls { )+ } - #[unstable = "waiting for Clone to stabilize"] + #[stable] impl<$($T:Clone),+> Clone for ($($T,)+) { fn clone(&self) -> ($($T,)+) { ($(e!(self.$idx.clone()),)+) @@ -328,4 +328,3 @@ tuple_impls! { (val11, ref11, mut11, 11) -> L } } - diff --git a/src/libstd/comm/mod.rs b/src/libstd/comm/mod.rs index 9043cb8c7d6..55f5662dbd8 100644 --- a/src/libstd/comm/mod.rs +++ b/src/libstd/comm/mod.rs @@ -628,7 +628,7 @@ impl Sender { } } -#[unstable] +#[stable] impl Clone for Sender { fn clone(&self) -> Sender { let (packet, sleeper, guard) = match *unsafe { self.inner() } { @@ -756,7 +756,7 @@ impl SyncSender { } } -#[unstable] +#[stable] impl Clone for SyncSender { fn clone(&self) -> SyncSender { unsafe { (*self.inner.get()).clone_chan(); } diff --git a/src/libstd/io/comm_adapters.rs b/src/libstd/io/comm_adapters.rs index e865bf42bd0..3a18b0dc1b5 100644 --- a/src/libstd/io/comm_adapters.rs +++ b/src/libstd/io/comm_adapters.rs @@ -132,6 +132,7 @@ impl ChanWriter { } } +#[stable] impl Clone for ChanWriter { fn clone(&self) -> ChanWriter { ChanWriter { tx: self.tx.clone() }