]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0324.md
Rollup merge of #93556 - dtolnay:trailingcomma, r=cjgillot
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0324.md
1 A method was implemented when another trait item was expected.
2
3 Erroneous code example:
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 ```