1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
trait MyTrait { fn get(&self) -> usize; } impl<T> MyTrait for T { fn get(&self) -> usize { 0 } } struct Foo { value: usize } impl MyTrait for Foo { //~ ERROR E0119 fn get(&self) -> usize { self.value } } fn main() { }