about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2015-07-17 15:54:44 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2015-07-21 19:28:58 +0200
commit95811546e6dabc1946a155c70a4635b9d76dcb8d (patch)
tree8fb33328e92da3864418e932d38344af010029ea
parentbc79f20ccac4ead82fae1464ea0916e78e04616f (diff)
downloadrust-95811546e6dabc1946a155c70a4635b9d76dcb8d.tar.gz
rust-95811546e6dabc1946a155c70a4635b9d76dcb8d.zip
Add E0407 error explanation
-rw-r--r--src/librustc_resolve/diagnostics.rs41
1 files changed, 37 insertions, 4 deletions
diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs
index d83829150c5..b135d9c0c4a 100644
--- a/src/librustc_resolve/diagnostics.rs
+++ b/src/librustc_resolve/diagnostics.rs
@@ -317,8 +317,7 @@ impl Foo for Bar { // ok!
 "##,
 
 E0405: r##"
-You tried to implement an undefined trait on an object. Example of
-erroneous code:
+A non-trait was implemented. Example of erroneous code:
 
 ```
 struct Foo;
@@ -344,7 +343,42 @@ impl SomeTrait for Foo { // ok!
     // implements functions
 }
 ```
-"##
+"##,
+
+E0407: r##"
+A definition of a method not in the implemented trait was given. Example of
+erroneous code:
+
+```
+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 mispelled the method name and you used the good
+trait. Example:
+
+```
+trait Foo {
+    fn a();
+    fn b();
+}
+
+struct Bar;
+
+impl Foo for Bar {
+    fn a() {}
+    fn b() {} // ok!
+}
+```
+"##,
 
 }
 
@@ -357,7 +391,6 @@ register_diagnostics! {
     E0401, // can't use type parameters from outer function
     E0402, // cannot use an outer type parameter in this context
     E0406, // undeclared associated type
-    E0407, // method is not a member of trait
     E0408, // variable from pattern #1 is not bound in pattern #
     E0409, // variable is bound with different mode in pattern # than in
            // pattern #1