1// run-rustfix 2 3use std::ops::Add; 4 5struct A<B>(B); 6 7impl<B> Add for A<B> where B: Add + Add<Output = B> { 8 type Output = Self; 9 10 fn add(self, rhs: Self) -> Self { 11 A(self.0 + rhs.0) //~ ERROR mismatched types 12 } 13} 14 15struct C<B>(B); 16 17impl<B: Add + Add<Output = B>> Add for C<B> { 18 type Output = Self; 19 20 fn add(self, rhs: Self) -> Self { 21 Self(self.0 + rhs.0) //~ ERROR mismatched types 22 } 23} 24 25struct D<B>(B); 26 27impl<B: std::ops::Add<Output = B>> Add for D<B> { 28 type Output = Self; 29 30 fn add(self, rhs: Self) -> Self { 31 Self(self.0 + rhs.0) //~ ERROR cannot add `B` to `B` 32 } 33} 34 35struct E<B>(B); 36 37impl<B: Add> Add for E<B> where B: Add<Output = B> { 38 type Output = Self; 39 40 fn add(self, rhs: Self) -> Self { 41 Self(self.0 + rhs.0) 42 } 43} 44 45fn main() {} 46