]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0205.md
Rollup merge of #92310 - ehuss:rustdoc-ice, r=estebank
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0205.md
1 #### Note: this error code is no longer emitted by the compiler.
2
3 An attempt to implement the `Copy` trait for an enum failed because one of the
4 variants does not implement `Copy`. To fix this, you must implement `Copy` for
5 the mentioned variant. Note that this may not be possible, as in the example of
6
7 ```compile_fail,E0204
8 enum Foo {
9     Bar(Vec<u32>),
10     Baz,
11 }
12
13 impl Copy for Foo { }
14 ```
15
16 This fails because `Vec<T>` does not implement `Copy` for any `T`.
17
18 Here's another example that will fail:
19
20 ```compile_fail,E0204
21 #[derive(Copy)]
22 enum Foo<'a> {
23     Bar(&'a mut bool),
24     Baz,
25 }
26 ```
27
28 This fails because `&mut T` is not `Copy`, even when `T` is `Copy` (this
29 differs from the behavior for `&T`, which is always `Copy`).