about summary refs log tree commit diff
path: root/src/libcore/marker.rs
diff options
context:
space:
mode:
authorRyan Scheel (Havvy) <ryan.havvy@gmail.com>2016-07-26 05:14:37 +0000
committerRyan Scheel (Havvy) <ryan.havvy@gmail.com>2016-08-01 05:43:13 +0000
commit157f7c1b30698dcdb2452e687f4940550a6e6467 (patch)
treed15b328218e3429f12153170bb6b6691f56a50d7 /src/libcore/marker.rs
parent9316ae515e2f8f3f497fb4f1559910c1eef2433d (diff)
downloadrust-157f7c1b30698dcdb2452e687f4940550a6e6467.tar.gz
rust-157f7c1b30698dcdb2452e687f4940550a6e6467.zip
Add Derive not possible question to Copy
This adds a question and answer to the Q&A section of the Copy
docs. Specifically, it asks the question I asked while reading
the docs, and gives its answer.
Diffstat (limited to 'src/libcore/marker.rs')
-rw-r--r--src/libcore/marker.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs
index c18d230be31..894982abaa9 100644
--- a/src/libcore/marker.rs
+++ b/src/libcore/marker.rs
@@ -144,6 +144,12 @@ pub trait Unsize<T: ?Sized> {
 /// Generalizing the latter case, any type implementing `Drop` can't be `Copy`, because it's
 /// managing some resource besides its own `size_of::<T>()` bytes.
 ///
+/// ## What if I derive `Copy` on a type that can't?
+///
+/// If you try to derive `Copy` on a struct or enum, you will get a compile-time error.
+/// Specifically, with structs you'll get [E0204](https://doc.rust-lang.org/error-index.html#E0204)
+/// and with enums you'll get [E0205](https://doc.rust-lang.org/error-index.html#E0205).
+///
 /// ## When should my type be `Copy`?
 ///
 /// Generally speaking, if your type _can_ implement `Copy`, it should. There's one important thing