]> git.lizzy.rs Git - rust.git/blob - src/librustc_error_codes/error_codes/E0438.md
Update const_forget.rs
[rust.git] / src / librustc_error_codes / error_codes / E0438.md
1 Trait implementations can only implement associated constants that are
2 members of the trait in question. This error indicates that you
3 attempted to implement an associated constant whose name does not
4 match the name of any associated constant in the trait.
5
6 Erroneous code example:
7
8 ```compile_fail,E0438
9 trait Foo {}
10
11 impl Foo for i32 {
12     const BAR: bool = true;
13 }
14 ```
15
16 The solution to this problem is to remove the extraneous associated constant:
17
18 ```
19 trait Foo {}
20
21 impl Foo for i32 {}
22 ```