]> git.lizzy.rs Git - rust.git/blob - src/librustc_error_codes/error_codes/E0204.md
Auto merge of #66396 - smmalis37:pythontest, r=alexcrichton
[rust.git] / src / librustc_error_codes / error_codes / E0204.md
1 An attempt to implement the `Copy` trait for a struct failed because one of the
2 fields does not implement `Copy`. To fix this, you must implement `Copy` for the
3 mentioned field. Note that this may not be possible, as in the example of
4
5 ```compile_fail,E0204
6 struct Foo {
7     foo : Vec<u32>,
8 }
9
10 impl Copy for Foo { }
11 ```
12
13 This fails because `Vec<T>` does not implement `Copy` for any `T`.
14
15 Here's another example that will fail:
16
17 ```compile_fail,E0204
18 #[derive(Copy)]
19 struct Foo<'a> {
20     ty: &'a mut bool,
21 }
22 ```
23
24 This fails because `&mut T` is not `Copy`, even when `T` is `Copy` (this
25 differs from the behavior for `&T`, which is always `Copy`).