]> git.lizzy.rs Git - rust.git/commitdiff
add long diagnostics for E0194
authorAlisdair Owens <awo101@zepler.net>
Mon, 10 Aug 2015 19:53:37 +0000 (20:53 +0100)
committerAlisdair Owens <awo101@zepler.net>
Tue, 11 Aug 2015 14:09:09 +0000 (15:09 +0100)
src/librustc_typeck/diagnostics.rs

index bd4e4fc31107c551e33dfd1b1f42ec2f18430e32..e7f3c780fac076376a45a10bcd30f7dfcf9479dc 100644 (file)
@@ -1840,6 +1840,22 @@ fn bar(&self) { }
 to also specify it in a `where` clause.
 "##,
 
+E0194: r##"
+A type parameter was declared which shadows an existing one. An example of this
+error:
+
+```
+trait Foo<T> {
+    fn do_something(&self) -> T;
+    fn do_something_else<T: Clone>(&self, bar: T);
+}
+```
+
+In this example, the trait `Foo` and the trait method `do_something_else` both
+define a type parameter `T`. This is not allowed: if the method wishes to
+define a type parameter, it must use a different name for it.
+"##,
+
 E0195: r##"
 Your method's lifetime parameters do not match the trait declaration.
 Erroneous code example:
@@ -2595,7 +2611,6 @@ struct Foo<'a, T: 'a> {
     E0188, // can not cast a immutable reference to a mutable pointer
     E0189, // deprecated: can only cast a boxed pointer to a boxed object
     E0190, // deprecated: can only cast a &-pointer to an &-object
-    E0194,
     E0196, // cannot determine a type for this closure
     E0203, // type parameter has more than one relaxed default bound,
            // and only one is supported