about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2018-03-23 11:37:11 +0100
committerSimon Sapin <simon.sapin@exyr.org>2018-03-23 15:12:10 +0100
commit00721de714785a8abf95a6403a66a19de6a58fc3 (patch)
tree75891df949aec59a1e46f8be228030d8b34b7e16
parentee67e14034438972c5aae46f8773fe69f20f14aa (diff)
downloadrust-00721de714785a8abf95a6403a66a19de6a58fc3.tar.gz
rust-00721de714785a8abf95a6403a66a19de6a58fc3.zip
Mention closures in docs for Clone and Copy
-rw-r--r--src/libcore/clone.rs5
-rw-r--r--src/libcore/marker.rs5
2 files changed, 10 insertions, 0 deletions
diff --git a/src/libcore/clone.rs b/src/libcore/clone.rs
index 826420a0c00..d25f498b99e 100644
--- a/src/libcore/clone.rs
+++ b/src/libcore/clone.rs
@@ -63,6 +63,11 @@
 /// This trait can be used with `#[derive]` if all fields are `Clone`. The `derive`d
 /// implementation of [`clone`] calls [`clone`] on each field.
 ///
+/// ## Closures
+///
+/// Closure types automatically implement `Clone` if they capture no value from the environment
+/// or if all such captured values implement `Clone` themselves.
+///
 /// ## How can I implement `Clone`?
 ///
 /// Types that are [`Copy`] should have a trivial implementation of `Clone`. More formally:
diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs
index f8a33961811..7d0174a178a 100644
--- a/src/libcore/marker.rs
+++ b/src/libcore/marker.rs
@@ -166,6 +166,11 @@ pub trait Unsize<T: ?Sized> {
 /// are allowed to access `x` after the assignment. Under the hood, both a copy and a move
 /// can result in bits being copied in memory, although this is sometimes optimized away.
 ///
+/// ## Closures
+///
+/// Closure types automatically implement `Copy` if they capture no value from the environment
+/// or if all such captured values implement `Copy` themselves.
+///
 /// ## How can I implement `Copy`?
 ///
 /// There are two ways to implement `Copy` on your type. The simplest is to use `derive`: