Skip to content

Commit adbd5d7

Browse files
brsonalexcrichton
authored andcommitted
core: Add stability attributes to Clone
The following are tagged 'unstable' - core::clone - Clone - Clone::clone - impl Clone for Arc - impl Clone for arc::Weak - impl Clone for Rc - impl Clone for rc::Weak - impl Clone for Vec - impl Clone for Cell - impl Clone for RefCell - impl Clone for small tuples The following are tagged 'experimental' - Clone::clone_from - may not provide enough utility - impls for various extern "Rust" fns - may not handle lifetimes correctly See https://github.com/rust-lang/rust/wiki/Meeting-API-review-2014-06-23#clone
1 parent 1ea2efe commit adbd5d7

File tree

8 files changed

+14
-0
lines changed

8 files changed

+14
-0
lines changed

src/liballoc/arc.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ impl<T: Share + Send> Arc<T> {
110110
}
111111
}
112112

113+
#[unstable]
113114
impl<T: Share + Send> Clone for Arc<T> {
114115
/// Duplicate an atomically reference counted wrapper.
115116
///
@@ -236,6 +237,7 @@ impl<T: Share + Send> Weak<T> {
236237
}
237238
}
238239

240+
#[unstable]
239241
impl<T: Share + Send> Clone for Weak<T> {
240242
#[inline]
241243
fn clone(&self) -> Weak<T> {

src/liballoc/owned.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ impl<T: Default> Default for Box<T> {
4242
fn default() -> Box<T> { box Default::default() }
4343
}
4444

45+
#[unstable]
4546
impl<T: Clone> Clone for Box<T> {
4647
/// Return a copy of the owned box.
4748
#[inline]

src/liballoc/rc.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ impl<T> Drop for Rc<T> {
143143
}
144144
}
145145

146+
#[unstable]
146147
impl<T> Clone for Rc<T> {
147148
#[inline]
148149
fn clone(&self) -> Rc<T> {
@@ -224,6 +225,7 @@ impl<T> Drop for Weak<T> {
224225
}
225226
}
226227

228+
#[unstable]
227229
impl<T> Clone for Weak<T> {
228230
#[inline]
229231
fn clone(&self) -> Weak<T> {

src/libcollections/vec.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ impl<T: Clone> Vec<T> {
316316
}
317317
}
318318

319+
#[unstable]
319320
impl<T:Clone> Clone for Vec<T> {
320321
fn clone(&self) -> Vec<T> {
321322
let len = self.len;

src/libcore/cell.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ impl<T:Copy> Cell<T> {
192192
}
193193
}
194194

195+
#[unstable]
195196
impl<T:Copy> Clone for Cell<T> {
196197
fn clone(&self) -> Cell<T> {
197198
Cell::new(self.get())
@@ -298,6 +299,7 @@ impl<T> RefCell<T> {
298299
}
299300
}
300301

302+
#[unstable]
301303
impl<T: Clone> Clone for RefCell<T> {
302304
fn clone(&self) -> RefCell<T> {
303305
RefCell::new(self.borrow().clone())

src/libcore/clone.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ the `clone` method.
2121
2222
*/
2323

24+
#![unstable]
25+
2426
/// A common trait for cloning an object.
2527
pub trait Clone {
2628
/// Returns a copy of the value. The contents of owned pointers
@@ -34,6 +36,7 @@ pub trait Clone {
3436
/// but can be overridden to reuse the resources of `a` to avoid unnecessary
3537
/// allocations.
3638
#[inline(always)]
39+
#[experimental = "this function is mostly unused"]
3740
fn clone_from(&mut self, source: &Self) {
3841
*self = source.clone()
3942
}
@@ -88,6 +91,7 @@ clone_impl!(char)
8891

8992
macro_rules! extern_fn_clone(
9093
($($A:ident),*) => (
94+
#[experimental = "this may not be sufficient for fns with region parameters"]
9195
impl<$($A,)* ReturnType> Clone for extern "Rust" fn($($A),*) -> ReturnType {
9296
/// Return a copy of a function pointer
9397
#[inline]

src/libcore/tuple.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ macro_rules! tuple_impls {
104104
)+
105105
}
106106

107+
#[unstable]
107108
impl<$($T:Clone),+> Clone for ($($T,)+) {
108109
fn clone(&self) -> ($($T,)+) {
109110
($(self.$refN().clone(),)+)

src/libstd/gc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ pub struct Gc<T> {
3737
marker: marker::NoSend,
3838
}
3939

40+
#[unstable]
4041
impl<T> Clone for Gc<T> {
4142
/// Clone the pointer only
4243
#[inline]

0 commit comments

Comments
 (0)