]>
Commit | Line | Data |
---|---|---|
f9f354fc XL |
1 | use std::ops::Add; |
2 | ||
3 | struct A<B>(B); | |
4 | ||
5 | impl<B> Add for A<B> where B: Add { | |
6 | type Output = Self; | |
7 | ||
8 | fn add(self, rhs: Self) -> Self { | |
9 | A(self.0 + rhs.0) //~ ERROR mismatched types | |
10 | } | |
11 | } | |
12 | ||
13 | struct C<B>(B); | |
14 | ||
15 | impl<B: Add> Add for C<B> { | |
16 | type Output = Self; | |
17 | ||
18 | fn add(self, rhs: Self) -> Self { | |
19 | Self(self.0 + rhs.0) //~ ERROR mismatched types | |
20 | } | |
21 | } | |
22 | ||
23 | struct D<B>(B); | |
24 | ||
25 | impl<B> Add for D<B> { | |
26 | type Output = Self; | |
27 | ||
28 | fn add(self, rhs: Self) -> Self { | |
29 | Self(self.0 + rhs.0) //~ ERROR cannot add `B` to `B` | |
30 | } | |
31 | } | |
32 | ||
33 | struct E<B>(B); | |
34 | ||
a2a8927a XL |
35 | impl<B: Add> Add for E<B> where <B as Add>::Output = B { |
36 | //~^ ERROR equality constraints are not yet supported in `where` clauses | |
f9f354fc XL |
37 | type Output = Self; |
38 | ||
39 | fn add(self, rhs: Self) -> Self { | |
a2a8927a | 40 | Self(self.0 + rhs.0) //~ ERROR mismatched types |
f9f354fc XL |
41 | } |
42 | } | |
43 | ||
44 | fn main() {} |