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