1
1
error[E0308]: mismatched types
2
- --> $DIR/trait-with-missing-associated-type-restriction.rs:13:9
2
+ --> $DIR/trait-with-missing-associated-type-restriction.rs:10:31
3
+ |
4
+ LL | fn funq(&self) -> Self::A {}
5
+ | ^^ expected associated type, found `()`
6
+ |
7
+ = note: expected associated type `<Self as Trait<T>>::A`
8
+ found unit type `()`
9
+ help: a method is available that returns `<Self as Trait<T>>::A`
10
+ --> $DIR/trait-with-missing-associated-type-restriction.rs:8:5
11
+ |
12
+ LL | fn func(&self) -> Self::A;
13
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ consider calling `Trait::func`
14
+
15
+ error[E0308]: mismatched types
16
+ --> $DIR/trait-with-missing-associated-type-restriction.rs:14:9
3
17
|
4
18
LL | qux(x.func())
5
19
| ^^^^^^^^ expected `usize`, found associated type
@@ -12,7 +26,7 @@ LL | fn foo(_: impl Trait, x: impl Trait<A = usize>) {
12
26
| ^^^^^^^^^^^
13
27
14
28
error[E0308]: mismatched types
15
- --> $DIR/trait-with-missing-associated-type-restriction.rs:17 :9
29
+ --> $DIR/trait-with-missing-associated-type-restriction.rs:18 :9
16
30
|
17
31
LL | qux(x.func())
18
32
| ^^^^^^^^ expected `usize`, found associated type
@@ -25,7 +39,7 @@ LL | fn bar<T: Trait<A = usize>>(x: T) {
25
39
| ^^^^^^^^^^^
26
40
27
41
error[E0308]: mismatched types
28
- --> $DIR/trait-with-missing-associated-type-restriction.rs:21 :9
42
+ --> $DIR/trait-with-missing-associated-type-restriction.rs:22 :9
29
43
|
30
44
LL | qux(x.func())
31
45
| ^^^^^^^^ expected `usize`, found associated type
@@ -38,25 +52,28 @@ LL | fn foo2(x: impl Trait<i32, A = usize>) {
38
52
| ^^^^^^^^^^^
39
53
40
54
error[E0308]: mismatched types
41
- --> $DIR/trait-with-missing-associated-type-restriction.rs:25 :12
55
+ --> $DIR/trait-with-missing-associated-type-restriction.rs:26 :12
42
56
|
43
57
LL | x.funk(3);
44
58
| ^ expected associated type, found integer
45
59
|
46
60
= note: expected associated type `<T as Trait<i32>>::A`
47
61
found type `{integer}`
48
- help: a method is available that returns `<T as Trait<i32>>::A`
62
+ help: some methods are available that return `<T as Trait<i32>>::A`
49
63
--> $DIR/trait-with-missing-associated-type-restriction.rs:8:5
50
64
|
51
65
LL | fn func(&self) -> Self::A;
52
66
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ consider calling `Trait::func`
67
+ LL | fn funk(&self, _: Self::A);
68
+ LL | fn funq(&self) -> Self::A {}
69
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ consider calling `Trait::funq`
53
70
help: consider constraining the associated type `<T as Trait<i32>>::A` to `{integer}`
54
71
|
55
72
LL | fn bar2<T: Trait<i32, A = {integer}>>(x: T) {
56
73
| ^^^^^^^^^^^^^^^
57
74
58
75
error[E0308]: mismatched types
59
- --> $DIR/trait-with-missing-associated-type-restriction.rs:26 :9
76
+ --> $DIR/trait-with-missing-associated-type-restriction.rs:27 :9
60
77
|
61
78
LL | qux(x.func())
62
79
| ^^^^^^^^ expected `usize`, found associated type
@@ -69,7 +86,7 @@ LL | fn bar2<T: Trait<i32, A = usize>>(x: T) {
69
86
| ^^^^^^^^^^^
70
87
71
88
error[E0308]: mismatched types
72
- --> $DIR/trait-with-missing-associated-type-restriction.rs:30 :9
89
+ --> $DIR/trait-with-missing-associated-type-restriction.rs:31 :9
73
90
|
74
91
LL | fn baz<D: std::fmt::Debug, T: Trait<A = D>>(x: T) {
75
92
| - this type parameter
@@ -80,13 +97,13 @@ LL | qux(x.func())
80
97
found type parameter `D`
81
98
82
99
error[E0308]: mismatched types
83
- --> $DIR/trait-with-missing-associated-type-restriction.rs:34 :9
100
+ --> $DIR/trait-with-missing-associated-type-restriction.rs:35 :9
84
101
|
85
102
LL | qux(x.func())
86
103
| ^^^^^^^^ expected `usize`, found `()`
87
104
88
105
error[E0308]: mismatched types
89
- --> $DIR/trait-with-missing-associated-type-restriction.rs:38 :9
106
+ --> $DIR/trait-with-missing-associated-type-restriction.rs:39 :9
90
107
|
91
108
LL | qux(x.func())
92
109
| ^^^^^^^^ expected `usize`, found associated type
@@ -98,6 +115,6 @@ help: consider constraining the associated type `<T as Trait>::A` to `usize`
98
115
LL | fn ban<T>(x: T) where T: Trait<A = usize> {
99
116
| ^^^^^^^^^^^
100
117
101
- error: aborting due to 8 previous errors
118
+ error: aborting due to 9 previous errors
102
119
103
120
For more information about this error, try `rustc --explain E0308`.
0 commit comments