Skip to content

Commit 92ccc07

Browse files
committed
Stabilize clone
This patch marks `clone` stable, as well as the `Clone` trait, but leaves `clone_from` unstable. The latter will be decided by the beta. The patch also marks most manual implementations of `Clone` as stable, except where the APIs are otherwise deprecated or where there is uncertainty about providing `Clone`.
1 parent 8443b09 commit 92ccc07

File tree

20 files changed

+37
-18
lines changed

20 files changed

+37
-18
lines changed

src/liballoc/arc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ pub fn weak_count<T>(this: &Arc<T>) -> uint { this.inner().weak.load(atomic::Seq
132132
#[experimental]
133133
pub fn strong_count<T>(this: &Arc<T>) -> uint { this.inner().strong.load(atomic::SeqCst) }
134134

135-
#[unstable = "waiting on stability of Clone"]
135+
#[stable]
136136
impl<T> Clone for Arc<T> {
137137
/// Duplicate an atomically reference counted wrapper.
138138
///

src/liballoc/boxed.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl<T> Default for Box<[T]> {
5757
fn default() -> Box<[T]> { box [] }
5858
}
5959

60-
#[unstable]
60+
#[stable]
6161
impl<T: Clone> Clone for Box<T> {
6262
/// Returns a copy of the owned box.
6363
#[inline]

src/liballoc/rc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ impl<T> Drop for Rc<T> {
413413
}
414414
}
415415

416-
#[unstable = "Clone is unstable."]
416+
#[stable]
417417
impl<T> Clone for Rc<T> {
418418
/// Makes a clone of the `Rc<T>`.
419419
///

src/libcollections/bit.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,7 @@ impl Extend<bool> for Bitv {
851851
}
852852
}
853853

854+
#[stable]
854855
impl Clone for Bitv {
855856
#[inline]
856857
fn clone(&self) -> Bitv {

src/libcollections/btree/node.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ impl<K, V> Node<K, V> {
390390
}
391391

392392
// FIXME(gereeter) Write an efficient clone_from
393+
#[stable]
393394
impl<K: Clone, V: Clone> Clone for Node<K, V> {
394395
fn clone(&self) -> Node<K, V> {
395396
let mut ret = if self.is_leaf() {

src/libcollections/dlist.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,7 @@ impl<A: Ord> Ord for DList<A> {
758758
}
759759
}
760760

761+
#[stable]
761762
impl<A: Clone> Clone for DList<A> {
762763
fn clone(&self) -> DList<A> {
763764
self.iter().map(|x| x.clone()).collect()

src/libcollections/ring_buf.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ pub struct RingBuf<T> {
4848
ptr: *mut T
4949
}
5050

51+
#[stable]
5152
impl<T: Clone> Clone for RingBuf<T> {
5253
fn clone(&self) -> RingBuf<T> {
5354
self.iter().map(|t| t.clone()).collect()

src/libcollections/vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ impl<T: Clone> Vec<T> {
443443
}
444444
}
445445

446-
#[unstable]
446+
#[stable]
447447
impl<T:Clone> Clone for Vec<T> {
448448
fn clone(&self) -> Vec<T> { self.as_slice().to_vec() }
449449

src/libcore/array.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use option::Option;
2525
macro_rules! array_impls {
2626
($($N:expr)+) => {
2727
$(
28-
#[unstable = "waiting for Clone to stabilize"]
28+
#[stable]
2929
impl<T:Copy> Clone for [T, ..$N] {
3030
fn clone(&self) -> [T, ..$N] {
3131
*self
@@ -115,4 +115,3 @@ array_impls! {
115115
20 21 22 23 24 25 26 27 28 29
116116
30 31 32
117117
}
118-

src/libcore/borrow.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ pub enum Cow<'a, T, Sized? B: 'a> where B: ToOwned<T> {
137137
Owned(T)
138138
}
139139

140+
#[stable]
140141
impl<'a, T, Sized? B> Clone for Cow<'a, T, B> where B: ToOwned<T> {
141142
fn clone(&self) -> Cow<'a, T, B> {
142143
match *self {

0 commit comments

Comments
 (0)