]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0046.md
Rollup merge of #92310 - ehuss:rustdoc-ice, r=estebank
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0046.md
1 Items are missing in a trait implementation.
2
3 Erroneous code example:
4
5 ```compile_fail,E0046
6 trait Foo {
7     fn foo();
8 }
9
10 struct Bar;
11
12 impl Foo for Bar {}
13 // error: not all trait items implemented, missing: `foo`
14 ```
15
16 When trying to make some type implement a trait `Foo`, you must, at minimum,
17 provide implementations for all of `Foo`'s required methods (meaning the
18 methods that do not have default implementations), as well as any required
19 trait items like associated types or constants. Example:
20
21 ```
22 trait Foo {
23     fn foo();
24 }
25
26 struct Bar;
27
28 impl Foo for Bar {
29     fn foo() {} // ok!
30 }
31 ```