diff options
| author | Carol (Nichols || Goulding) <carol.nichols@gmail.com> | 2016-05-23 12:58:42 -0400 |
|---|---|---|
| committer | Carol (Nichols || Goulding) <carol.nichols@gmail.com> | 2016-05-23 12:58:42 -0400 |
| commit | d2ee6e04ab7f2095351b48acff7c997dc4ac779a (patch) | |
| tree | b3953aacf8ce614ab675feb97777267d80fd57db /src/libcore | |
| parent | b4e123d3e0fd9459733f9ebb0802877a995abef4 (diff) | |
| download | rust-d2ee6e04ab7f2095351b48acff7c997dc4ac779a.tar.gz rust-d2ee6e04ab7f2095351b48acff7c997dc4ac779a.zip | |
Emphasize semantic differences of Copy/Clone rather than impl
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/clone.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libcore/clone.rs b/src/libcore/clone.rs index 3a5ba2387ac..82097c6b5e7 100644 --- a/src/libcore/clone.rs +++ b/src/libcore/clone.rs @@ -48,9 +48,10 @@ use marker::Sized; /// A common trait for the ability to explicitly duplicate an object. /// -/// Differs from `Copy` in that you can -/// define `Clone` to run arbitrary code, while you are not allowed to override -/// the implementation of `Copy` that only does a `memcpy`. +/// Differs from `Copy` in that `Copy` is implicit and extremely inexpensive, while +/// `Clone` is always explicit and may or may not be expensive. In order to enforce +/// these characteristics, Rust does not allow you to reimplement `Copy`, but you +/// may reimplement `Clone` and run arbitrary code. /// /// Since `Clone` is more general than `Copy`, you can automatically make anything /// `Copy` be `Clone` as well. |
