Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: Add stability attributes to Clone #15135

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/liballoc/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ impl<T: Share + Send> Arc<T> {
}
}

#[unstable]
impl<T: Share + Send> Clone for Arc<T> {
/// Duplicate an atomically reference counted wrapper.
///
Expand Down Expand Up @@ -236,6 +237,7 @@ impl<T: Share + Send> Weak<T> {
}
}

#[unstable]
impl<T: Share + Send> Clone for Weak<T> {
#[inline]
fn clone(&self) -> Weak<T> {
Expand Down
1 change: 1 addition & 0 deletions src/liballoc/owned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ impl<T: Default> Default for Box<T> {
fn default() -> Box<T> { box Default::default() }
}

#[unstable]
impl<T: Clone> Clone for Box<T> {
/// Return a copy of the owned box.
#[inline]
Expand Down
2 changes: 2 additions & 0 deletions src/liballoc/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ impl<T> Drop for Rc<T> {
}
}

#[unstable]
impl<T> Clone for Rc<T> {
#[inline]
fn clone(&self) -> Rc<T> {
Expand Down Expand Up @@ -224,6 +225,7 @@ impl<T> Drop for Weak<T> {
}
}

#[unstable]
impl<T> Clone for Weak<T> {
#[inline]
fn clone(&self) -> Weak<T> {
Expand Down
1 change: 1 addition & 0 deletions src/libcollections/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ impl<T: Clone> Vec<T> {
}
}

#[unstable]
impl<T:Clone> Clone for Vec<T> {
fn clone(&self) -> Vec<T> {
let len = self.len;
Expand Down
2 changes: 2 additions & 0 deletions src/libcore/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ impl<T:Copy> Cell<T> {
}
}

#[unstable]
impl<T:Copy> Clone for Cell<T> {
fn clone(&self) -> Cell<T> {
Cell::new(self.get())
Expand Down Expand Up @@ -298,6 +299,7 @@ impl<T> RefCell<T> {
}
}

#[unstable]
impl<T: Clone> Clone for RefCell<T> {
fn clone(&self) -> RefCell<T> {
RefCell::new(self.borrow().clone())
Expand Down
4 changes: 4 additions & 0 deletions src/libcore/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ the `clone` method.

*/

#![unstable]

/// A common trait for cloning an object.
pub trait Clone {
/// Returns a copy of the value. The contents of owned pointers
Expand All @@ -34,6 +36,7 @@ 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"]
fn clone_from(&mut self, source: &Self) {
*self = source.clone()
}
Expand Down Expand Up @@ -88,6 +91,7 @@ clone_impl!(char)

macro_rules! extern_fn_clone(
($($A:ident),*) => (
#[experimental = "this may not be sufficient for fns with region parameters"]
impl<$($A,)* ReturnType> Clone for extern "Rust" fn($($A),*) -> ReturnType {
/// Return a copy of a function pointer
#[inline]
Expand Down
1 change: 1 addition & 0 deletions src/libcore/tuple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ macro_rules! tuple_impls {
)+
}

#[unstable]
impl<$($T:Clone),+> Clone for ($($T,)+) {
fn clone(&self) -> ($($T,)+) {
($(self.$refN().clone(),)+)
Expand Down
1 change: 1 addition & 0 deletions src/libstd/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pub struct Gc<T> {
marker: marker::NoSend,
}

#[unstable]
impl<T> Clone for Gc<T> {
/// Clone the pointer only
#[inline]
Expand Down