Skip to content

Commit ef4f2d6

Browse files
authored
Rollup merge of #150139 - GKFX:clone-docs, r=jhpratt
Correct terminology in Clone I think the current wording around Clone here is confusing: - "Rust does not allow you to reimplement `Copy`" - reimplement isn't a piece of Rust terminology, but as written it sounds like you can't write `impl Copy for X`, which you can. - "you may reimplement `Clone`" - again reimplement isn't really a thing that you do to a trait, the distinction is between manually implementing and deriving. - "you can automatically make anything `Copy` be `Clone` as well" - you don't have a choice about it, so it doesn't really make sense to say you "can ... make" this happen.
2 parents 1c2dbcf + 82499ba commit ef4f2d6

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

library/core/src/clone.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ mod uninit;
5252
/// original.
5353
///
5454
/// Differs from [`Copy`] in that [`Copy`] is implicit and an inexpensive bit-wise copy, while
55-
/// `Clone` is always explicit and may or may not be expensive. In order to enforce
56-
/// these characteristics, Rust does not allow you to reimplement [`Copy`], but you
57-
/// may reimplement `Clone` and run arbitrary code.
55+
/// `Clone` is always explicit and may or may not be expensive. [`Copy`] has no methods, so you
56+
/// cannot change its behavior, but when implementing `Clone`, the `clone` method you provide
57+
/// may run arbitrary code.
5858
///
59-
/// Since `Clone` is more general than [`Copy`], you can automatically make anything
60-
/// [`Copy`] be `Clone` as well.
59+
/// Since `Clone` is a supertrait of [`Copy`], any type that implements `Copy` must also implement
60+
/// `Clone`.
6161
///
6262
/// ## Derivable
6363
///

0 commit comments

Comments
 (0)