Skip to content

Commit d6f83c5

Browse files
Clean up E0371 explanation
1 parent f56042f commit d6f83c5

File tree

1 file changed

+7
-5
lines changed
  • src/librustc_error_codes/error_codes

1 file changed

+7
-5
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
When `Trait2` is a subtrait of `Trait1` (for example, when `Trait2` has a
2-
definition like `trait Trait2: Trait1 { ... }`), it is not allowed to implement
3-
`Trait1` for `Trait2`. This is because `Trait2` already implements `Trait1` by
4-
definition, so it is not useful to do this.
1+
A trait was implemented on another which already automatically implemented it.
52

6-
Example:
3+
Erroneous code examples:
74

85
```compile_fail,E0371
96
trait Foo { fn foo(&self) { } }
@@ -15,3 +12,8 @@ impl Foo for Baz { } // error, `Baz` implements `Bar` which implements `Foo`
1512
impl Baz for Baz { } // error, `Baz` (trivially) implements `Baz`
1613
impl Baz for Bar { } // Note: This is OK
1714
```
15+
16+
When `Trait2` is a subtrait of `Trait1` (for example, when `Trait2` has a
17+
definition like `trait Trait2: Trait1 { ... }`), it is not allowed to implement
18+
`Trait1` for `Trait2`. This is because `Trait2` already implements `Trait1` by
19+
definition, so it is not useful to do this.

0 commit comments

Comments
 (0)