]> git.proxmox.com Git - rustc.git/blame - src/librustc_error_codes/error_codes/E0407.md
New upstream version 1.47.0+dfsg1
[rustc.git] / src / librustc_error_codes / error_codes / E0407.md
CommitLineData
60c5eb7d
XL
1A definition of a method not in the implemented trait was given in a trait
2implementation.
3
4Erroneous code example:
5
6```compile_fail,E0407
7trait Foo {
8 fn a();
9}
10
11struct Bar;
12
13impl Foo for Bar {
14 fn a() {}
15 fn b() {} // error: method `b` is not a member of trait `Foo`
16}
17```
18
19Please verify you didn't misspell the method name and you used the correct
20trait. First example:
21
22```
23trait Foo {
24 fn a();
25 fn b();
26}
27
28struct Bar;
29
30impl Foo for Bar {
31 fn a() {}
32 fn b() {} // ok!
33}
34```
35
36Second example:
37
38```
39trait Foo {
40 fn a();
41}
42
43struct Bar;
44
45impl Foo for Bar {
46 fn a() {}
47}
48
49impl Bar {
50 fn b() {}
51}
52```