]>
Commit | Line | Data |
---|---|---|
74b04a01 XL |
1 | A method was implemented when another trait item was expected. |
2 | ||
3 | Erroneous code example: | |
60c5eb7d XL |
4 | |
5 | ```compile_fail,E0324 | |
6 | struct Bar; | |
7 | ||
8 | trait Foo { | |
9 | const N : u32; | |
10 | ||
11 | fn M(); | |
12 | } | |
13 | ||
14 | impl Foo for Bar { | |
15 | fn N() {} | |
16 | // error: item `N` is an associated method, which doesn't match its | |
17 | // trait `<Bar as Foo>` | |
18 | } | |
19 | ``` | |
20 | ||
21 | To fix this error, please verify that the method name wasn't misspelled and | |
22 | verify that you are indeed implementing the correct trait items. Example: | |
23 | ||
24 | ``` | |
25 | struct Bar; | |
26 | ||
27 | trait Foo { | |
28 | const N : u32; | |
29 | ||
30 | fn M(); | |
31 | } | |
32 | ||
33 | impl Foo for Bar { | |
34 | const N : u32 = 0; | |
35 | ||
36 | fn M() {} // ok! | |
37 | } | |
38 | ``` |