]>
Commit | Line | Data |
---|---|---|
ba9703b0 XL |
1 | An associated type whose name does not match any of the associated types |
2 | in the trait was used when implementing the trait. | |
60c5eb7d XL |
3 | |
4 | Erroneous code example: | |
5 | ||
6 | ```compile_fail,E0437 | |
7 | trait Foo {} | |
8 | ||
9 | impl Foo for i32 { | |
10 | type Bar = bool; | |
11 | } | |
12 | ``` | |
13 | ||
ba9703b0 XL |
14 | Trait implementations can only implement associated types that are members of |
15 | the trait in question. | |
16 | ||
60c5eb7d XL |
17 | The solution to this problem is to remove the extraneous associated type: |
18 | ||
19 | ``` | |
20 | trait Foo {} | |
21 | ||
22 | impl Foo for i32 {} | |
23 | ``` |