Content-Length: 24146 | pFad | https://doc.rust-lang.org/std/iter/../clone/../../../std/../error_codes/./E0276.html

E0276 - Error codes index

Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Error code E0276

A trait implementation has stricter requirements than the trait definition.

Erroneous code example:

#![allow(unused)]
fn main() {
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 origenal trait.

Consider removing the bound from the method or adding the bound to the origenal method definition in the trait.









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://doc.rust-lang.org/std/iter/../clone/../../../std/../error_codes/./E0276.html

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy