]> git.lizzy.rs Git - rust.git/blob - src/librustc_error_codes/error_codes/E0276.md
Auto merge of #68154 - ssomers:btreemap_navigation_benches, r=Mark-Simulacrum
[rust.git] / src / librustc_error_codes / error_codes / E0276.md
1 This error occurs when a bound in an implementation of a trait does not match
2 the bounds specified in the original trait. For example:
3
4 ```compile_fail,E0276
5 trait Foo {
6     fn foo<T>(x: T);
7 }
8
9 impl Foo for bool {
10     fn foo<T>(x: T) where T: Copy {}
11 }
12 ```
13
14 Here, all types implementing `Foo` must have a method `foo<T>(x: T)` which can
15 take any type `T`. However, in the `impl` for `bool`, we have added an extra
16 bound that `T` is `Copy`, which isn't compatible with the original trait.
17
18 Consider removing the bound from the method or adding the bound to the original
19 method definition in the trait.