Skip to content

Clean up error codes #68365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/librustc_error_codes/error_codes/E0201.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
It is an error to define two associated items (like methods, associated types,
associated functions, etc.) with the same identifier.
Two associated items (like methods, associated types, associated functions,
etc.) were defined with the same identifier.

For example:
Erroneous code example:

```compile_fail,E0201
struct Foo(u8);
Expand Down
17 changes: 10 additions & 7 deletions src/librustc_error_codes/error_codes/E0204.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
An attempt to implement the `Copy` trait for a struct failed because one of the
fields does not implement `Copy`. To fix this, you must implement `Copy` for the
mentioned field. Note that this may not be possible, as in the example of
The `Copy` trait was implemented on a type which contains a field that doesn't
implement the `Copy` trait.

Erroneous code example:

```compile_fail,E0204
struct Foo {
foo : Vec<u32>,
foo: Vec<u32>,
}

impl Copy for Foo { }
impl Copy for Foo { } // error!
```

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

Here's another example that will fail:

```compile_fail,E0204
#[derive(Copy)]
#[derive(Copy)] // error!
struct Foo<'a> {
ty: &'a mut bool,
}
Expand Down