summaryrefslogtreecommitdiffstats
path: root/tests/ui/generic-associated-types/missing-bounds.stderr
blob: 9f669b9a5214b1694bb3c42331ca48480826526f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
error: equality constraints are not yet supported in `where` clauses
  --> $DIR/missing-bounds.rs:37:33
   |
LL | impl<B: Add> Add for E<B> where <B as Add>::Output = B {
   |                                 ^^^^^^^^^^^^^^^^^^^^^^ not supported
   |
   = note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information
help: if `Output` is an associated type you're trying to set, use the associated type binding syntax
   |
LL | impl<B: Add> Add for E<B> where B: Add<Output = B> {
   |                                 ~~~~~~~~~~~~~~~~~~

error[E0308]: mismatched types
  --> $DIR/missing-bounds.rs:11:11
   |
LL | impl<B> Add for A<B> where B: Add {
   |      - this type parameter
...
LL |         A(self.0 + rhs.0)
   |         - ^^^^^^^^^^^^^^ expected type parameter `B`, found associated type
   |         |
   |         arguments to this struct are incorrect
   |
   = note: expected type parameter `B`
             found associated type `<B as Add>::Output`
help: the type constructed contains `<B as Add>::Output` due to the type of the argument passed
  --> $DIR/missing-bounds.rs:11:9
   |
LL |         A(self.0 + rhs.0)
   |         ^^--------------^
   |           |
   |           this argument influences the type of `A`
note: tuple struct defined here
  --> $DIR/missing-bounds.rs:5:8
   |
LL | struct A<B>(B);
   |        ^
help: consider further restricting this bound
   |
LL | impl<B> Add for A<B> where B: Add + Add<Output = B> {
   |                                   +++++++++++++++++

error[E0308]: mismatched types
  --> $DIR/missing-bounds.rs:21:14
   |
LL | impl<B: Add> Add for C<B> {
   |      - this type parameter
...
LL |         Self(self.0 + rhs.0)
   |         ---- ^^^^^^^^^^^^^^ expected type parameter `B`, found associated type
   |         |
   |         arguments to this function are incorrect
   |
   = note: expected type parameter `B`
             found associated type `<B as Add>::Output`
note: tuple struct defined here
  --> $DIR/missing-bounds.rs:15:8
   |
LL | struct C<B>(B);
   |        ^
help: consider further restricting this bound
   |
LL | impl<B: Add + Add<Output = B>> Add for C<B> {
   |             +++++++++++++++++

error[E0369]: cannot add `B` to `B`
  --> $DIR/missing-bounds.rs:31:21
   |
LL |         Self(self.0 + rhs.0)
   |              ------ ^ ----- B
   |              |
   |              B
   |
help: consider restricting type parameter `B`
   |
LL | impl<B: std::ops::Add<Output = B>> Add for D<B> {
   |       +++++++++++++++++++++++++++

error[E0308]: mismatched types
  --> $DIR/missing-bounds.rs:42:14
   |
LL | impl<B: Add> Add for E<B> where <B as Add>::Output = B {
   |      - this type parameter
...
LL |         Self(self.0 + rhs.0)
   |         ---- ^^^^^^^^^^^^^^ expected type parameter `B`, found associated type
   |         |
   |         arguments to this function are incorrect
   |
   = note: expected type parameter `B`
             found associated type `<B as Add>::Output`
note: tuple struct defined here
  --> $DIR/missing-bounds.rs:35:8
   |
LL | struct E<B>(B);
   |        ^
help: consider further restricting this bound
   |
LL | impl<B: Add + Add<Output = B>> Add for E<B> where <B as Add>::Output = B {
   |             +++++++++++++++++

error: aborting due to 5 previous errors

Some errors have detailed explanations: E0308, E0369.
For more information about an error, try `rustc --explain E0308`.