File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change 6363/// This trait can be used with `#[derive]` if all fields are `Clone`. The `derive`d
6464/// implementation of [`clone`] calls [`clone`] on each field.
6565///
66+ /// ## Closures
67+ ///
68+ /// Closure types automatically implement `Clone` if they capture no value from the environment
69+ /// or if all such captured values implement `Clone` themselves.
70+ ///
6671/// ## How can I implement `Clone`?
6772///
6873/// Types that are [`Copy`] should have a trivial implementation of `Clone`. More formally:
Original file line number Diff line number Diff line change @@ -166,6 +166,11 @@ pub trait Unsize<T: ?Sized> {
166166/// are allowed to access `x` after the assignment. Under the hood, both a copy and a move
167167/// can result in bits being copied in memory, although this is sometimes optimized away.
168168///
169+ /// ## Closures
170+ ///
171+ /// Closure types automatically implement `Copy` if they capture no value from the environment
172+ /// or if all such captured values implement `Copy` themselves.
173+ ///
169174/// ## How can I implement `Copy`?
170175///
171176/// There are two ways to implement `Copy` on your type. The simplest is to use `derive`:
You can’t perform that action at this time.
0 commit comments