]> git.lizzy.rs Git - rust.git/blob - tests/ui/generic-associated-types/missing-bounds.fixed
Rollup merge of #106441 - mllken:abstract-socket-noref, r=joshtriplett
[rust.git] / tests / ui / generic-associated-types / missing-bounds.fixed
1 // run-rustfix
2
3 use std::ops::Add;
4
5 struct A<B>(B);
6
7 impl<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
15 struct C<B>(B);
16
17 impl<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
25 struct D<B>(B);
26
27 impl<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
35 struct E<B>(B);
36
37 impl<B: Add + Add<Output = B>> Add for E<B> where B: Add<Output = B> {
38     //~^ ERROR equality constraints are not yet supported in `where` clauses
39     type Output = Self;
40
41     fn add(self, rhs: Self) -> Self {
42         Self(self.0 + rhs.0) //~ ERROR mismatched types
43     }
44 }
45
46 fn main() {}