11error[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
317 |
418LL | qux(x.func())
519 | ^^^^^^^^ expected `usize`, found associated type
@@ -12,7 +26,7 @@ LL | fn foo(_: impl Trait, x: impl Trait<A = usize>) {
1226 | ^^^^^^^^^^^
1327
1428error[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
1630 |
1731LL | qux(x.func())
1832 | ^^^^^^^^ expected `usize`, found associated type
@@ -25,7 +39,7 @@ LL | fn bar<T: Trait<A = usize>>(x: T) {
2539 | ^^^^^^^^^^^
2640
2741error[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
2943 |
3044LL | qux(x.func())
3145 | ^^^^^^^^ expected `usize`, found associated type
@@ -38,25 +52,28 @@ LL | fn foo2(x: impl Trait<i32, A = usize>) {
3852 | ^^^^^^^^^^^
3953
4054error[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
4256 |
4357LL | x.funk(3);
4458 | ^ expected associated type, found integer
4559 |
4660 = note: expected associated type `<T as Trait<i32>>::A`
4761 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`
4963 --> $DIR/trait-with-missing-associated-type-restriction.rs:8:5
5064 |
5165LL | fn func(&self) -> Self::A;
5266 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ consider calling `Trait::func`
67+ LL | fn funk(&self, _: Self::A);
68+ LL | fn funq(&self) -> Self::A {}
69+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ consider calling `Trait::funq`
5370help: consider constraining the associated type `<T as Trait<i32>>::A` to `{integer}`
5471 |
5572LL | fn bar2<T: Trait<i32, A = {integer}>>(x: T) {
5673 | ^^^^^^^^^^^^^^^
5774
5875error[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
6077 |
6178LL | qux(x.func())
6279 | ^^^^^^^^ expected `usize`, found associated type
@@ -69,7 +86,7 @@ LL | fn bar2<T: Trait<i32, A = usize>>(x: T) {
6986 | ^^^^^^^^^^^
7087
7188error[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
7390 |
7491LL | fn baz<D: std::fmt::Debug, T: Trait<A = D>>(x: T) {
7592 | - this type parameter
@@ -80,13 +97,13 @@ LL | qux(x.func())
8097 found type parameter `D`
8198
8299error[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
84101 |
85102LL | qux(x.func())
86103 | ^^^^^^^^ expected `usize`, found `()`
87104
88105error[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
90107 |
91108LL | qux(x.func())
92109 | ^^^^^^^^ expected `usize`, found associated type
@@ -98,6 +115,6 @@ help: consider constraining the associated type `<T as Trait>::A` to `usize`
98115LL | fn ban<T>(x: T) where T: Trait<A = usize> {
99116 | ^^^^^^^^^^^
100117
101- error: aborting due to 8 previous errors
118+ error: aborting due to 9 previous errors
102119
103120For more information about this error, try `rustc --explain E0308`.
0 commit comments