summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_error_codes/src/error_codes/E0407.md
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_error_codes/src/error_codes/E0407.md')
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0407.md52
1 files changed, 52 insertions, 0 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0407.md b/compiler/rustc_error_codes/src/error_codes/E0407.md
new file mode 100644
index 000000000..fa26c77a1
--- /dev/null
+++ b/compiler/rustc_error_codes/src/error_codes/E0407.md
@@ -0,0 +1,52 @@
+A definition of a method not in the implemented trait was given in a trait
+implementation.
+
+Erroneous code example:
+
+```compile_fail,E0407
+trait Foo {
+ fn a();
+}
+
+struct Bar;
+
+impl Foo for Bar {
+ fn a() {}
+ fn b() {} // error: method `b` is not a member of trait `Foo`
+}
+```
+
+Please verify you didn't misspell the method name and you used the correct
+trait. First example:
+
+```
+trait Foo {
+ fn a();
+ fn b();
+}
+
+struct Bar;
+
+impl Foo for Bar {
+ fn a() {}
+ fn b() {} // ok!
+}
+```
+
+Second example:
+
+```
+trait Foo {
+ fn a();
+}
+
+struct Bar;
+
+impl Foo for Bar {
+ fn a() {}
+}
+
+impl Bar {
+ fn b() {}
+}
+```