]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generic-associated-types/missing-bounds.rs
Merge commit 'e8dca3e87d164d2806098c462c6ce41301341f68' into sync_from_cg_gcc
[rust.git] / src / test / ui / generic-associated-types / missing-bounds.rs
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
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
37     type Output = Self;
38
39     fn add(self, rhs: Self) -> Self {
40         Self(self.0 + rhs.0) //~ ERROR mismatched types
41     }
42 }
43
44 fn main() {}