Skip to content

Commit 7ffd523

Browse files
committed
core: Update clone docs
1 parent 26babaa commit 7ffd523

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/libcore/clone.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ by convention implementing the `Clone` trait and calling the
2525
use core::kinds::Const;
2626

2727
pub trait Clone {
28-
/// Return a deep copy of the owned object tree. Types with shared ownership like managed boxes
29-
/// are cloned with a shallow copy.
28+
/// Returns a copy of the value. The contents of owned pointers
29+
/// are copied to maintain uniqueness, while the contents of
30+
/// managed pointers are not copied.
3031
fn clone(&self) -> Self;
3132
}
3233

@@ -85,8 +86,9 @@ clone_impl!(bool)
8586
clone_impl!(char)
8687

8788
pub trait DeepClone {
88-
/// Return a deep copy of the object tree. Types with shared ownership are also copied via a
89-
/// deep copy, unlike `Clone`.
89+
/// Return a deep copy of the value. Unlike `Clone`, the contents of shared pointer types
90+
/// *are* copied. Note that this is currently unimplemented for managed boxes, as
91+
/// it would need to handle cycles, but it is implemented for other smart-pointer types.
9092
fn deep_clone(&self) -> Self;
9193
}
9294

0 commit comments

Comments
 (0)