]> git.lizzy.rs Git - rust.git/blob - src/test/ui/suggestions/trait-with-missing-associated-type-restriction.stderr
Rollup merge of #90420 - GuillaumeGomez:rustdoc-internals-feature, r=camelid
[rust.git] / src / test / ui / suggestions / trait-with-missing-associated-type-restriction.stderr
1 error[E0308]: mismatched types
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
17    |
18 LL |     qux(x.func())
19    |         ^^^^^^^^ expected `usize`, found associated type
20    |
21    = note:         expected type `usize`
22            found associated type `<impl Trait as Trait>::A`
23 help: consider constraining the associated type `<impl Trait as Trait>::A` to `usize`
24    |
25 LL | fn foo(_: impl Trait, x: impl Trait<A = usize>) {
26    |                                    +++++++++++
27
28 error[E0308]: mismatched types
29   --> $DIR/trait-with-missing-associated-type-restriction.rs:18:9
30    |
31 LL |     qux(x.func())
32    |         ^^^^^^^^ expected `usize`, found associated type
33    |
34    = note:         expected type `usize`
35            found associated type `<T as Trait>::A`
36 help: consider constraining the associated type `<T as Trait>::A` to `usize`
37    |
38 LL | fn bar<T: Trait<A = usize>>(x: T) {
39    |                +++++++++++
40
41 error[E0308]: mismatched types
42   --> $DIR/trait-with-missing-associated-type-restriction.rs:22:9
43    |
44 LL |     qux(x.func())
45    |         ^^^^^^^^ expected `usize`, found associated type
46    |
47    = note:         expected type `usize`
48            found associated type `<impl Trait<i32> as Trait<i32>>::A`
49 help: consider constraining the associated type `<impl Trait<i32> as Trait<i32>>::A` to `usize`
50    |
51 LL | fn foo2(x: impl Trait<i32, A = usize>) {
52    |                          +++++++++++
53
54 error[E0308]: mismatched types
55   --> $DIR/trait-with-missing-associated-type-restriction.rs:26:12
56    |
57 LL |     x.funk(3);
58    |            ^ expected associated type, found integer
59    |
60    = note: expected associated type `<T as Trait<i32>>::A`
61                          found type `{integer}`
62 help: some methods are available that return `<T as Trait<i32>>::A`
63   --> $DIR/trait-with-missing-associated-type-restriction.rs:8:5
64    |
65 LL |     fn func(&self) -> Self::A;
66    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ consider calling `Trait::func`
67 LL |     fn funk(&self, _: Self::A);
68 LL |     fn funq(&self) -> Self::A {}
69    |     ^^^^^^^^^^^^^^^^^^^^^^^^^ consider calling `Trait::funq`
70 help: consider constraining the associated type `<T as Trait<i32>>::A` to `{integer}`
71    |
72 LL | fn bar2<T: Trait<i32, A = {integer}>>(x: T) {
73    |                     +++++++++++++++
74
75 error[E0308]: mismatched types
76   --> $DIR/trait-with-missing-associated-type-restriction.rs:27:9
77    |
78 LL |     qux(x.func())
79    |         ^^^^^^^^ expected `usize`, found associated type
80    |
81    = note:         expected type `usize`
82            found associated type `<T as Trait<i32>>::A`
83 help: consider constraining the associated type `<T as Trait<i32>>::A` to `usize`
84    |
85 LL | fn bar2<T: Trait<i32, A = usize>>(x: T) {
86    |                     +++++++++++
87
88 error[E0308]: mismatched types
89   --> $DIR/trait-with-missing-associated-type-restriction.rs:31:9
90    |
91 LL | fn baz<D: std::fmt::Debug, T: Trait<A = D>>(x: T) {
92    |        - this type parameter
93 LL |     qux(x.func())
94    |         ^^^^^^^^ expected `usize`, found type parameter `D`
95    |
96    = note:        expected type `usize`
97            found type parameter `D`
98
99 error[E0308]: mismatched types
100   --> $DIR/trait-with-missing-associated-type-restriction.rs:35:9
101    |
102 LL |     qux(x.func())
103    |         ^^^^^^^^ expected `usize`, found `()`
104
105 error[E0308]: mismatched types
106   --> $DIR/trait-with-missing-associated-type-restriction.rs:39:9
107    |
108 LL |     qux(x.func())
109    |         ^^^^^^^^ expected `usize`, found associated type
110    |
111    = note:         expected type `usize`
112            found associated type `<T as Trait>::A`
113 help: consider constraining the associated type `<T as Trait>::A` to `usize`
114    |
115 LL | fn ban<T>(x: T) where T: Trait<A = usize> {
116    |                               +++++++++++
117
118 error: aborting due to 9 previous errors
119
120 For more information about this error, try `rustc --explain E0308`.