Skip to content

Commit 0259c10

Browse files
authored
Rollup merge of rust-lang#68365 - GuillaumeGomez:clean-up-err-codes-2, r=Dylan-DPC
Clean up error codes r? @Dylan-DPC
2 parents cd4652a + a9aa2df commit 0259c10

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

src/librustc_error_codes/error_codes/E0201.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
It is an error to define two associated items (like methods, associated types,
2-
associated functions, etc.) with the same identifier.
1+
Two associated items (like methods, associated types, associated functions,
2+
etc.) were defined with the same identifier.
33

4-
For example:
4+
Erroneous code example:
55

66
```compile_fail,E0201
77
struct Foo(u8);

src/librustc_error_codes/error_codes/E0204.md

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
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
1+
The `Copy` trait was implemented on a type which contains a field that doesn't
2+
implement the `Copy` trait.
3+
4+
Erroneous code example:
45

56
```compile_fail,E0204
67
struct Foo {
7-
foo : Vec<u32>,
8+
foo: Vec<u32>,
89
}
910
10-
impl Copy for Foo { }
11+
impl Copy for Foo { } // error!
1112
```
1213

13-
This fails because `Vec<T>` does not implement `Copy` for any `T`.
14+
The `Copy` trait is implemented by default only on primitive types. If your
15+
type only contains primitive types, you'll be able to implement `Copy` on it.
16+
Otherwise, it won't be possible.
1417

1518
Here's another example that will fail:
1619

1720
```compile_fail,E0204
18-
#[derive(Copy)]
21+
#[derive(Copy)] // error!
1922
struct Foo<'a> {
2023
ty: &'a mut bool,
2124
}

0 commit comments

Comments
 (0)