]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0399.md
Rollup merge of #92310 - ehuss:rustdoc-ice, r=estebank
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0399.md
1 #### Note: this error code is no longer emitted by the compiler
2
3 You implemented a trait, overriding one or more of its associated types but did
4 not reimplement its default methods.
5
6 Example of erroneous code:
7
8 ```
9 #![feature(associated_type_defaults)]
10
11 pub trait Foo {
12     type Assoc = u8;
13     fn bar(&self) {}
14 }
15
16 impl Foo for i32 {
17     // error - the following trait items need to be reimplemented as
18     //         `Assoc` was overridden: `bar`
19     type Assoc = i32;
20 }
21 ```
22
23 To fix this, add an implementation for each default method from the trait:
24
25 ```
26 #![feature(associated_type_defaults)]
27
28 pub trait Foo {
29     type Assoc = u8;
30     fn bar(&self) {}
31 }
32
33 impl Foo for i32 {
34     type Assoc = i32;
35     fn bar(&self) {} // ok!
36 }
37 ```