]> git.lizzy.rs Git - rust.git/commitdiff
Add long diagnostic for E0276
authorManish Goregaokar <manishsmail@gmail.com>
Wed, 22 Jul 2015 15:49:24 +0000 (21:19 +0530)
committerManish Goregaokar <manishsmail@gmail.com>
Fri, 24 Jul 2015 18:34:11 +0000 (00:04 +0530)
src/librustc/diagnostics.rs

index 5bd03ce598a3d00257efd36606f036b6f96dcee4..36655123927876928bc225d30dd9f0f66e08c7a7 100644 (file)
@@ -1462,6 +1462,28 @@ impl<T> Foo for T where Bar<T>: Foo {}
 Consider changing your trait bounds so that they're less self-referential.
 "##,
 
+E0276: r##"
+This error occurs when a bound in an implementation of a trait does not match
+the bounds specified in the original trait. For example:
+
+```
+trait Foo {
+ fn foo<T>(x: T);
+}
+
+impl Foo for bool {
+ fn foo<T>(x: T) where T: Copy {}
+}
+```
+
+Here, all types implementing `Foo` must have a method `foo<T>(x: T)` which can
+take any type `T`. However, in the `impl` for `bool`, we have added an extra
+bound that `T` is `Copy`, which isn't compatible with the original trait.
+
+Consider removing the bound from the method or adding the bound to the original
+method definition in the trait.
+"##,
+
 E0277: r##"
 You tried to use a type which doesn't implement some trait in a place which
 expected that trait. Erroneous code example:
@@ -1886,7 +1908,6 @@ fn foo<'a>(arg: &Box<SomeTrait+'a>) { ... }
 //  E0134,
 //  E0135,
     E0264, // unknown external lang item
-    E0276, // requirement appears on impl method but not on corresponding trait method
     E0278, // requirement is not satisfied
     E0279, // requirement is not satisfied
     E0280, // requirement is not satisfied