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