]> git.proxmox.com Git - rustc.git/blob - src/test/ui/associated-types/defaults-specialization.stderr
New upstream version 1.45.0+dfsg1
[rustc.git] / src / test / ui / associated-types / defaults-specialization.stderr
1 error[E0053]: method `make` has an incompatible type for trait
2 --> $DIR/defaults-specialization.rs:18:18
3 |
4 LL | fn make() -> Self::Ty {
5 | -------- type in trait
6 ...
7 LL | fn make() -> u8 { 0 }
8 | ^^ expected associated type, found `u8`
9 |
10 = note: expected fn pointer `fn() -> <A<T> as Tr>::Ty`
11 found fn pointer `fn() -> u8`
12
13 error[E0053]: method `make` has an incompatible type for trait
14 --> $DIR/defaults-specialization.rs:34:18
15 |
16 LL | fn make() -> Self::Ty {
17 | -------- type in trait
18 ...
19 LL | default type Ty = bool;
20 | ----------------------- expected this associated type
21 LL |
22 LL | fn make() -> bool { true }
23 | ^^^^ expected associated type, found `bool`
24 |
25 = note: expected fn pointer `fn() -> <B<T> as Tr>::Ty`
26 found fn pointer `fn() -> bool`
27
28 error[E0308]: mismatched types
29 --> $DIR/defaults-specialization.rs:9:9
30 |
31 LL | type Ty = u8;
32 | ------------- associated type defaults can't be assumed inside the trait defining them
33 LL |
34 LL | fn make() -> Self::Ty {
35 | -------- expected `<Self as Tr>::Ty` because of return type
36 LL | 0u8
37 | ^^^ expected associated type, found `u8`
38 |
39 = note: expected associated type `<Self as Tr>::Ty`
40 found type `u8`
41
42 error[E0308]: mismatched types
43 --> $DIR/defaults-specialization.rs:25:29
44 |
45 LL | fn make() -> Self::Ty { 0u8 }
46 | -------- ^^^ expected associated type, found `u8`
47 | |
48 | expected `<A2<T> as Tr>::Ty` because of return type
49 |
50 = note: expected associated type `<A2<T> as Tr>::Ty`
51 found type `u8`
52 = help: consider constraining the associated type `<A2<T> as Tr>::Ty` to `u8` or calling a method that returns `<A2<T> as Tr>::Ty`
53 = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
54
55 error[E0308]: mismatched types
56 --> $DIR/defaults-specialization.rs:43:29
57 |
58 LL | default type Ty = bool;
59 | ----------------------- expected this associated type
60 LL |
61 LL | fn make() -> Self::Ty { true }
62 | -------- ^^^^ expected associated type, found `bool`
63 | |
64 | expected `<B2<T> as Tr>::Ty` because of return type
65 |
66 = note: expected associated type `<B2<T> as Tr>::Ty`
67 found type `bool`
68
69 error[E0308]: mismatched types
70 --> $DIR/defaults-specialization.rs:86:32
71 |
72 LL | let _: <B<()> as Tr>::Ty = 0u8;
73 | ----------------- ^^^ expected associated type, found `u8`
74 | |
75 | expected due to this
76 |
77 = note: expected associated type `<B<()> as Tr>::Ty`
78 found type `u8`
79 help: a method is available that returns `<B<()> as Tr>::Ty`
80 --> $DIR/defaults-specialization.rs:8:5
81 |
82 LL | fn make() -> Self::Ty {
83 | ^^^^^^^^^^^^^^^^^^^^^ consider calling `Tr::make`
84
85 error[E0308]: mismatched types
86 --> $DIR/defaults-specialization.rs:87:32
87 |
88 LL | let _: <B<()> as Tr>::Ty = true;
89 | ----------------- ^^^^ expected associated type, found `bool`
90 | |
91 | expected due to this
92 |
93 = note: expected associated type `<B<()> as Tr>::Ty`
94 found type `bool`
95 help: a method is available that returns `<B<()> as Tr>::Ty`
96 --> $DIR/defaults-specialization.rs:8:5
97 |
98 LL | fn make() -> Self::Ty {
99 | ^^^^^^^^^^^^^^^^^^^^^ consider calling `Tr::make`
100
101 error[E0308]: mismatched types
102 --> $DIR/defaults-specialization.rs:88:33
103 |
104 LL | let _: <B2<()> as Tr>::Ty = 0u8;
105 | ------------------ ^^^ expected associated type, found `u8`
106 | |
107 | expected due to this
108 |
109 = note: expected associated type `<B2<()> as Tr>::Ty`
110 found type `u8`
111 help: a method is available that returns `<B2<()> as Tr>::Ty`
112 --> $DIR/defaults-specialization.rs:8:5
113 |
114 LL | fn make() -> Self::Ty {
115 | ^^^^^^^^^^^^^^^^^^^^^ consider calling `Tr::make`
116
117 error[E0308]: mismatched types
118 --> $DIR/defaults-specialization.rs:89:33
119 |
120 LL | let _: <B2<()> as Tr>::Ty = true;
121 | ------------------ ^^^^ expected associated type, found `bool`
122 | |
123 | expected due to this
124 |
125 = note: expected associated type `<B2<()> as Tr>::Ty`
126 found type `bool`
127 help: a method is available that returns `<B2<()> as Tr>::Ty`
128 --> $DIR/defaults-specialization.rs:8:5
129 |
130 LL | fn make() -> Self::Ty {
131 | ^^^^^^^^^^^^^^^^^^^^^ consider calling `Tr::make`
132
133 error: aborting due to 9 previous errors
134
135 Some errors have detailed explanations: E0053, E0308.
136 For more information about an error, try `rustc --explain E0053`.