File tree 2 files changed +10
-0
lines changed
2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change 63
63
/// This trait can be used with `#[derive]` if all fields are `Clone`. The `derive`d
64
64
/// implementation of [`clone`] calls [`clone`] on each field.
65
65
///
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
+ ///
66
71
/// ## How can I implement `Clone`?
67
72
///
68
73
/// 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> {
166
166
/// are allowed to access `x` after the assignment. Under the hood, both a copy and a move
167
167
/// can result in bits being copied in memory, although this is sometimes optimized away.
168
168
///
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
+ ///
169
174
/// ## How can I implement `Copy`?
170
175
///
171
176
/// 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