]> git.lizzy.rs Git - rust.git/blob - src/librustc_error_codes/error_codes/E0325.md
Auto merge of #66396 - smmalis37:pythontest, r=alexcrichton
[rust.git] / src / librustc_error_codes / error_codes / E0325.md
1 An associated type was implemented when another trait item was expected.
2 Erroneous code example:
3
4 ```compile_fail,E0325
5 struct Bar;
6
7 trait Foo {
8     const N : u32;
9 }
10
11 impl Foo for Bar {
12     type N = u32;
13     // error: item `N` is an associated type, which doesn't match its
14     //        trait `<Bar as Foo>`
15 }
16 ```
17
18 Please verify that the associated type name wasn't misspelled and your
19 implementation corresponds to the trait definition. Example:
20
21 ```
22 struct Bar;
23
24 trait Foo {
25     type N;
26 }
27
28 impl Foo for Bar {
29     type N = u32; // ok!
30 }
31 ```
32
33 Or:
34
35 ```
36 struct Bar;
37
38 trait Foo {
39     const N : u32;
40 }
41
42 impl Foo for Bar {
43     const N : u32 = 0; // ok!
44 }
45 ```