]> git.proxmox.com Git - rustc.git/blame - src/test/ui/generic-associated-types/missing-bounds.rs
New upstream version 1.62.1+dfsg1
[rustc.git] / src / test / ui / generic-associated-types / missing-bounds.rs
CommitLineData
f9f354fc
XL
1use std::ops::Add;
2
3struct A<B>(B);
4
5impl<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
13struct C<B>(B);
14
15impl<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
23struct D<B>(B);
24
25impl<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
33struct E<B>(B);
34
a2a8927a
XL
35impl<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
44fn main() {}