]> git.proxmox.com Git - rustc.git/blob - src/librustc_error_codes/error_codes/E0323.md
New upstream version 1.41.1+dfsg1
[rustc.git] / src / librustc_error_codes / error_codes / E0323.md
1 An associated const was implemented when another trait item was expected.
2 Erroneous code example:
3
4 ```compile_fail,E0323
5 trait Foo {
6 type N;
7 }
8
9 struct Bar;
10
11 impl Foo for Bar {
12 const N : u32 = 0;
13 // error: item `N` is an associated const, which doesn't match its
14 // trait `<Bar as Foo>`
15 }
16 ```
17
18 Please verify that the associated const wasn't misspelled and the correct trait
19 was implemented. 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 ```