about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrew Paseltiner <apaseltiner@gmail.com>2015-07-22 16:52:40 -0400
committerAndrew Paseltiner <apaseltiner@gmail.com>2015-07-22 16:53:50 -0400
commitcf8a1636ef5a5227d091cbfce8365a2a603f4f79 (patch)
tree0587040903b459b46f87825f3fa035d31272fdc6
parent55428306657c5b42a26183c90fcd06e1ee7b94f5 (diff)
downloadrust-cf8a1636ef5a5227d091cbfce8365a2a603f4f79.tar.gz
rust-cf8a1636ef5a5227d091cbfce8365a2a603f4f79.zip
add diagnostics for E0437 and E0438
-rw-r--r--src/librustc_resolve/diagnostics.rs53
1 files changed, 51 insertions, 2 deletions
diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs
index 5a941c757fc..9f8a5c90d4e 100644
--- a/src/librustc_resolve/diagnostics.rs
+++ b/src/librustc_resolve/diagnostics.rs
@@ -426,6 +426,57 @@ use something_which_doesnt_exist;
 Please verify you didn't misspell the import's name.
 "##,
 
+E0437: r##"
+Trait impls can only implement associated types that are members of the trait in
+question. This error indicates that you attempted to implement an associated
+type whose name does not match the name of any associated type in the trait.
+
+Here is an example that demonstrates the error:
+
+```
+trait Foo {}
+
+impl Foo for i32 {
+    type Bar = bool;
+}
+```
+
+The solution to this problem is to remove the extraneous associated type:
+
+```
+trait Foo {}
+
+impl Foo for i32 {}
+```
+"##,
+
+E0438: r##"
+Trait impls can only implement associated constants that are members of the
+trait in question. This error indicates that you attempted to implement an
+associated constant whose name does not match the name of any associated
+constant in the trait.
+
+Here is an example that demonstrates the error:
+
+```
+#![feature(associated_consts)]
+
+trait Foo {}
+
+impl Foo for i32 {
+    const BAR: bool = true;
+}
+```
+
+The solution to this problem is to remove the extraneous associated constant:
+
+```
+trait Foo {}
+
+impl Foo for i32 {}
+```
+"##
+
 }
 
 register_diagnostics! {
@@ -468,6 +519,4 @@ register_diagnostics! {
     E0432, // unresolved import
     E0434, // can't capture dynamic environment in a fn item
     E0435, // attempt to use a non-constant value in a constant
-    E0437, // type is not a member of trait
-    E0438, // const is not a member of trait
 }