]> git.proxmox.com Git - rustc.git/blame - src/test/ui/generic-associated-types/missing-bounds.fixed
New upstream version 1.65.0+dfsg1
[rustc.git] / src / test / ui / generic-associated-types / missing-bounds.fixed
CommitLineData
064997fb
FG
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
f2b60f7d 27impl<B: std::ops::Add<Output = B>> Add for D<B> {
064997fb
FG
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<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
46fn main() {}