]> git.proxmox.com Git - rustc.git/blob - src/librustc_error_codes/error_codes/E0276.md
New upstream version 1.43.0+dfsg1
[rustc.git] / src / librustc_error_codes / error_codes / E0276.md
1 A trait implementation has stricter requirements than the trait definition.
2
3 Erroneous code example:
4
5 ```compile_fail,E0276
6 trait Foo {
7 fn foo<T>(x: T);
8 }
9
10 impl Foo for bool {
11 fn foo<T>(x: T) where T: Copy {}
12 }
13 ```
14
15 Here, all types implementing `Foo` must have a method `foo<T>(x: T)` which can
16 take any type `T`. However, in the `impl` for `bool`, we have added an extra
17 bound that `T` is `Copy`, which isn't compatible with the original trait.
18
19 Consider removing the bound from the method or adding the bound to the original
20 method definition in the trait.