about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-12-09 23:41:16 +0000
committerbors <bors@rust-lang.org>2015-12-09 23:41:16 +0000
commit81ae8be71c5ce8e3b5f6b7ef480d140ed2248cf2 (patch)
treef6681a4b8a1862c9f0ac9122010719da1e0cd9d7
parent0b49cb1dca26c56791c5f772a5f42a331548a4b2 (diff)
parent1671af139485d263ff7b63fc25b0ed7f833b030e (diff)
downloadrust-81ae8be71c5ce8e3b5f6b7ef480d140ed2248cf2.tar.gz
rust-81ae8be71c5ce8e3b5f6b7ef480d140ed2248cf2.zip
Auto merge of #30284 - GuillaumeGomez:patch-3, r=Manishearth
r? @Manishearth
-rw-r--r--src/librustc/diagnostics.rs36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs
index 86dd363993a..cde8e7a6d1e 100644
--- a/src/librustc/diagnostics.rs
+++ b/src/librustc/diagnostics.rs
@@ -989,6 +989,41 @@ enum Method { GET, POST }
 ```
 "##,
 
+E0229: r##"
+An associated type binding was done outside of the type parameter declaration
+and `where` clause. Erroneous code example:
+
+```
+pub trait Foo {
+    type A;
+    fn boo(&self) -> <Self as Foo>::A;
+}
+
+struct Bar;
+
+impl Foo for isize {
+    type A = usize;
+    fn boo(&self) -> usize { 42 }
+}
+
+fn baz<I>(x: &<I as Foo<A=Bar>>::A) {}
+// error: associated type bindings are not allowed here
+```
+
+To solve this error, please move the type bindings in the type parameter
+declaration:
+
+```
+fn baz<I: Foo<A=Bar>>(x: &<I as Foo>::A) {} // ok!
+```
+
+or in the `where` clause:
+
+```
+fn baz<I>(x: &<I as Foo>::A) where I: Foo<A=Bar> {}
+```
+"##,
+
 E0261: r##"
 When using a lifetime like `'a` in a type, it must be declared before being
 used.
@@ -2241,7 +2276,6 @@ register_diagnostics! {
     // E0006 // merged with E0005
 //  E0134,
 //  E0135,
-    E0229, // associated type bindings are not allowed here
     E0278, // requirement is not satisfied
     E0279, // requirement is not satisfied
     E0280, // requirement is not satisfied