Skip to content

Commit 7835c8c

Browse files
authored
docs(marker/copy): clarify that &T is also Copy
In the current documentation about the `Copy` marker trait, there is a section about "additional implementors", which list additional implementors of the `Copy` trait. The fact that shared references are also `Copy` is mixed with another point, which makes it hard to recognize and make it seem not as important. This clarifies the fact that shared references are also `Copy`, by mentioning it as a separate item in the list of "additional implementors".
1 parent 1e99138 commit 7835c8c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

library/core/src/marker.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,8 @@ pub trait StructuralEq {
347347
/// * Tuple types, if each component also implements `Copy` (e.g., `()`, `(i32, bool)`)
348348
/// * Closure types, if they capture no value from the environment
349349
/// or if all such captured values implement `Copy` themselves.
350-
/// Note that variables captured by shared reference always implement `Copy`
351-
/// (even if the referent doesn't),
352-
/// while variables captured by mutable reference never implement `Copy`.
350+
/// * Variables captured by shared reference (e.g. `&T`) implement `Copy`, even if the referent (`T`) doesn't,
351+
/// while variables captured by mutable reference (e.g. `&mut T`) never implement `Copy`.
353352
///
354353
/// [`Vec<T>`]: ../../std/vec/struct.Vec.html
355354
/// [`String`]: ../../std/string/struct.String.html

0 commit comments

Comments
 (0)