Skip to content
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

Clean up e0370 e0371 #69457

Merged
merged 2 commits into from
Feb 26, 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
4 changes: 3 additions & 1 deletion src/librustc_error_codes/error_codes/E0370.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
The maximum value of an enum was reached, so it cannot be automatically
set in the next enum value. Erroneous code example:
set in the next enum value.

Erroneous code example:

```compile_fail,E0370
#[repr(i64)]
Expand Down
12 changes: 7 additions & 5 deletions src/librustc_error_codes/error_codes/E0371.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
When `Trait2` is a subtrait of `Trait1` (for example, when `Trait2` has a
definition like `trait Trait2: Trait1 { ... }`), it is not allowed to implement
`Trait1` for `Trait2`. This is because `Trait2` already implements `Trait1` by
definition, so it is not useful to do this.
A trait was implemented on another which already automatically implemented it.

Example:
Erroneous code examples:

```compile_fail,E0371
trait Foo { fn foo(&self) { } }
Expand All @@ -15,3 +12,8 @@ impl Foo for Baz { } // error, `Baz` implements `Bar` which implements `Foo`
impl Baz for Baz { } // error, `Baz` (trivially) implements `Baz`
impl Baz for Bar { } // Note: This is OK
```

When `Trait2` is a subtrait of `Trait1` (for example, when `Trait2` has a
definition like `trait Trait2: Trait1 { ... }`), it is not allowed to implement
`Trait1` for `Trait2`. This is because `Trait2` already implements `Trait1` by
definition, so it is not useful to do this.