]>
Commit | Line | Data |
---|---|---|
416331ca XL |
1 | error[E0423]: expected value, found struct variant `E::B` |
2 | --> $DIR/fn-or-tuple-struct-without-args.rs:36:16 | |
3 | | | |
e74abb32 XL |
4 | LL | A(usize), |
5 | | -------- similarly named tuple variant `A` defined here | |
6 | LL | B { a: usize }, | |
7 | | -------------- `E::B` defined here | |
8 | ... | |
416331ca | 9 | LL | let _: E = E::B; |
3dfed10e XL |
10 | | ^^^^ |
11 | | | |
12 | help: use struct literal syntax instead | |
13 | | | |
14 | LL | let _: E = E::B { a: val }; | |
94222f64 | 15 | | ~~~~~~~~~~~~~~~ |
3dfed10e XL |
16 | help: a tuple variant with a similar name exists |
17 | | | |
18 | LL | let _: E = E::A; | |
94222f64 | 19 | | ~ |
416331ca XL |
20 | |
21 | error[E0308]: mismatched types | |
22 | --> $DIR/fn-or-tuple-struct-without-args.rs:29:20 | |
23 | | | |
24 | LL | fn foo(a: usize, b: usize) -> usize { a } | |
25 | | ----------------------------------- fn(usize, usize) -> usize {foo} defined here | |
26 | ... | |
27 | LL | let _: usize = foo; | |
ba9703b0 XL |
28 | | ----- ^^^ expected `usize`, found fn item |
29 | | | | |
60c5eb7d | 30 | | expected due to this |
416331ca XL |
31 | | |
32 | = note: expected type `usize` | |
60c5eb7d | 33 | found fn item `fn(usize, usize) -> usize {foo}` |
ba9703b0 XL |
34 | help: use parentheses to call this function |
35 | | | |
f2b60f7d FG |
36 | LL | let _: usize = foo(/* usize */, /* usize */); |
37 | | ++++++++++++++++++++++++++ | |
416331ca XL |
38 | |
39 | error[E0308]: mismatched types | |
40 | --> $DIR/fn-or-tuple-struct-without-args.rs:30:16 | |
41 | | | |
42 | LL | struct S(usize, usize); | |
064997fb | 43 | | -------- fn(usize, usize) -> S {S} defined here |
416331ca XL |
44 | ... |
45 | LL | let _: S = S; | |
ba9703b0 XL |
46 | | - ^ expected struct `S`, found fn item |
47 | | | | |
60c5eb7d | 48 | | expected due to this |
416331ca | 49 | | |
60c5eb7d XL |
50 | = note: expected struct `S` |
51 | found fn item `fn(usize, usize) -> S {S}` | |
ba9703b0 XL |
52 | help: use parentheses to instantiate this tuple struct |
53 | | | |
f2b60f7d FG |
54 | LL | let _: S = S(/* usize */, /* usize */); |
55 | | ++++++++++++++++++++++++++ | |
416331ca XL |
56 | |
57 | error[E0308]: mismatched types | |
58 | --> $DIR/fn-or-tuple-struct-without-args.rs:31:20 | |
59 | | | |
60 | LL | fn bar() -> usize { 42 } | |
61 | | ----------------- fn() -> usize {bar} defined here | |
62 | ... | |
63 | LL | let _: usize = bar; | |
ba9703b0 XL |
64 | | ----- ^^^ expected `usize`, found fn item |
65 | | | | |
60c5eb7d | 66 | | expected due to this |
416331ca XL |
67 | | |
68 | = note: expected type `usize` | |
60c5eb7d | 69 | found fn item `fn() -> usize {bar}` |
ba9703b0 XL |
70 | help: use parentheses to call this function |
71 | | | |
72 | LL | let _: usize = bar(); | |
94222f64 | 73 | | ++ |
416331ca XL |
74 | |
75 | error[E0308]: mismatched types | |
76 | --> $DIR/fn-or-tuple-struct-without-args.rs:32:16 | |
77 | | | |
78 | LL | struct V(); | |
064997fb | 79 | | -------- fn() -> V {V} defined here |
416331ca XL |
80 | ... |
81 | LL | let _: V = V; | |
ba9703b0 XL |
82 | | - ^ expected struct `V`, found fn item |
83 | | | | |
60c5eb7d | 84 | | expected due to this |
416331ca | 85 | | |
60c5eb7d XL |
86 | = note: expected struct `V` |
87 | found fn item `fn() -> V {V}` | |
ba9703b0 XL |
88 | help: use parentheses to instantiate this tuple struct |
89 | | | |
90 | LL | let _: V = V(); | |
94222f64 | 91 | | ++ |
416331ca XL |
92 | |
93 | error[E0308]: mismatched types | |
94 | --> $DIR/fn-or-tuple-struct-without-args.rs:33:20 | |
95 | | | |
96 | LL | fn baz(x: usize, y: usize) -> usize { x } | |
97 | | ----------------------------------- fn(usize, usize) -> usize {<_ as T>::baz} defined here | |
98 | ... | |
99 | LL | let _: usize = T::baz; | |
ba9703b0 XL |
100 | | ----- ^^^^^^ expected `usize`, found fn item |
101 | | | | |
60c5eb7d | 102 | | expected due to this |
416331ca XL |
103 | | |
104 | = note: expected type `usize` | |
60c5eb7d | 105 | found fn item `fn(usize, usize) -> usize {<_ as T>::baz}` |
f2b60f7d | 106 | help: use parentheses to call this associated function |
ba9703b0 | 107 | | |
f2b60f7d FG |
108 | LL | let _: usize = T::baz(/* usize */, /* usize */); |
109 | | ++++++++++++++++++++++++++ | |
416331ca XL |
110 | |
111 | error[E0308]: mismatched types | |
112 | --> $DIR/fn-or-tuple-struct-without-args.rs:34:20 | |
113 | | | |
114 | LL | fn bat(x: usize) -> usize { 42 } | |
115 | | ------------------------- fn(usize) -> usize {<_ as T>::bat} defined here | |
116 | ... | |
117 | LL | let _: usize = T::bat; | |
ba9703b0 XL |
118 | | ----- ^^^^^^ expected `usize`, found fn item |
119 | | | | |
60c5eb7d | 120 | | expected due to this |
416331ca XL |
121 | | |
122 | = note: expected type `usize` | |
60c5eb7d | 123 | found fn item `fn(usize) -> usize {<_ as T>::bat}` |
f2b60f7d | 124 | help: use parentheses to call this associated function |
ba9703b0 | 125 | | |
f2b60f7d FG |
126 | LL | let _: usize = T::bat(/* usize */); |
127 | | +++++++++++++ | |
416331ca XL |
128 | |
129 | error[E0308]: mismatched types | |
130 | --> $DIR/fn-or-tuple-struct-without-args.rs:35:16 | |
131 | | | |
132 | LL | A(usize), | |
064997fb | 133 | | - fn(usize) -> E {E::A} defined here |
416331ca XL |
134 | ... |
135 | LL | let _: E = E::A; | |
ba9703b0 XL |
136 | | - ^^^^ expected enum `E`, found fn item |
137 | | | | |
60c5eb7d | 138 | | expected due to this |
416331ca | 139 | | |
60c5eb7d XL |
140 | = note: expected enum `E` |
141 | found fn item `fn(usize) -> E {E::A}` | |
ba9703b0 XL |
142 | help: use parentheses to instantiate this tuple variant |
143 | | | |
f2b60f7d FG |
144 | LL | let _: E = E::A(/* usize */); |
145 | | +++++++++++++ | |
416331ca XL |
146 | |
147 | error[E0308]: mismatched types | |
148 | --> $DIR/fn-or-tuple-struct-without-args.rs:37:20 | |
149 | | | |
150 | LL | fn baz(x: usize, y: usize) -> usize { x } | |
151 | | ----------------------------------- fn(usize, usize) -> usize {<X as T>::baz} defined here | |
152 | ... | |
153 | LL | let _: usize = X::baz; | |
ba9703b0 XL |
154 | | ----- ^^^^^^ expected `usize`, found fn item |
155 | | | | |
60c5eb7d | 156 | | expected due to this |
416331ca XL |
157 | | |
158 | = note: expected type `usize` | |
60c5eb7d | 159 | found fn item `fn(usize, usize) -> usize {<X as T>::baz}` |
f2b60f7d | 160 | help: use parentheses to call this associated function |
ba9703b0 | 161 | | |
f2b60f7d FG |
162 | LL | let _: usize = X::baz(/* usize */, /* usize */); |
163 | | ++++++++++++++++++++++++++ | |
416331ca XL |
164 | |
165 | error[E0308]: mismatched types | |
166 | --> $DIR/fn-or-tuple-struct-without-args.rs:38:20 | |
167 | | | |
168 | LL | fn bat(x: usize) -> usize { 42 } | |
169 | | ------------------------- fn(usize) -> usize {<X as T>::bat} defined here | |
170 | ... | |
171 | LL | let _: usize = X::bat; | |
ba9703b0 XL |
172 | | ----- ^^^^^^ expected `usize`, found fn item |
173 | | | | |
60c5eb7d | 174 | | expected due to this |
416331ca XL |
175 | | |
176 | = note: expected type `usize` | |
60c5eb7d | 177 | found fn item `fn(usize) -> usize {<X as T>::bat}` |
f2b60f7d | 178 | help: use parentheses to call this associated function |
ba9703b0 | 179 | | |
f2b60f7d FG |
180 | LL | let _: usize = X::bat(/* usize */); |
181 | | +++++++++++++ | |
416331ca XL |
182 | |
183 | error[E0308]: mismatched types | |
184 | --> $DIR/fn-or-tuple-struct-without-args.rs:39:20 | |
185 | | | |
186 | LL | fn bax(x: usize) -> usize { 42 } | |
187 | | ------------------------- fn(usize) -> usize {<X as T>::bax} defined here | |
188 | ... | |
189 | LL | let _: usize = X::bax; | |
ba9703b0 XL |
190 | | ----- ^^^^^^ expected `usize`, found fn item |
191 | | | | |
60c5eb7d | 192 | | expected due to this |
416331ca XL |
193 | | |
194 | = note: expected type `usize` | |
60c5eb7d | 195 | found fn item `fn(usize) -> usize {<X as T>::bax}` |
f2b60f7d | 196 | help: use parentheses to call this associated function |
ba9703b0 | 197 | | |
f2b60f7d FG |
198 | LL | let _: usize = X::bax(/* usize */); |
199 | | +++++++++++++ | |
416331ca XL |
200 | |
201 | error[E0308]: mismatched types | |
202 | --> $DIR/fn-or-tuple-struct-without-args.rs:40:20 | |
203 | | | |
204 | LL | fn bach(x: usize) -> usize; | |
205 | | --------------------------- fn(usize) -> usize {<X as T>::bach} defined here | |
206 | ... | |
207 | LL | let _: usize = X::bach; | |
ba9703b0 XL |
208 | | ----- ^^^^^^^ expected `usize`, found fn item |
209 | | | | |
60c5eb7d | 210 | | expected due to this |
416331ca XL |
211 | | |
212 | = note: expected type `usize` | |
60c5eb7d | 213 | found fn item `fn(usize) -> usize {<X as T>::bach}` |
f2b60f7d | 214 | help: use parentheses to call this associated function |
ba9703b0 | 215 | | |
f2b60f7d FG |
216 | LL | let _: usize = X::bach(/* usize */); |
217 | | +++++++++++++ | |
416331ca XL |
218 | |
219 | error[E0308]: mismatched types | |
220 | --> $DIR/fn-or-tuple-struct-without-args.rs:41:20 | |
221 | | | |
222 | LL | fn ban(&self) -> usize { 42 } | |
223 | | ---------------------- for<'r> fn(&'r X) -> usize {<X as T>::ban} defined here | |
224 | ... | |
225 | LL | let _: usize = X::ban; | |
ba9703b0 XL |
226 | | ----- ^^^^^^ expected `usize`, found fn item |
227 | | | | |
60c5eb7d | 228 | | expected due to this |
416331ca XL |
229 | | |
230 | = note: expected type `usize` | |
60c5eb7d | 231 | found fn item `for<'r> fn(&'r X) -> usize {<X as T>::ban}` |
f2b60f7d | 232 | help: use parentheses to call this associated function |
ba9703b0 | 233 | | |
f2b60f7d FG |
234 | LL | let _: usize = X::ban(/* &X */); |
235 | | ++++++++++ | |
416331ca XL |
236 | |
237 | error[E0308]: mismatched types | |
238 | --> $DIR/fn-or-tuple-struct-without-args.rs:42:20 | |
239 | | | |
240 | LL | fn bal(&self) -> usize; | |
241 | | ----------------------- for<'r> fn(&'r X) -> usize {<X as T>::bal} defined here | |
242 | ... | |
243 | LL | let _: usize = X::bal; | |
ba9703b0 XL |
244 | | ----- ^^^^^^ expected `usize`, found fn item |
245 | | | | |
60c5eb7d | 246 | | expected due to this |
416331ca XL |
247 | | |
248 | = note: expected type `usize` | |
60c5eb7d | 249 | found fn item `for<'r> fn(&'r X) -> usize {<X as T>::bal}` |
f2b60f7d | 250 | help: use parentheses to call this associated function |
ba9703b0 | 251 | | |
f2b60f7d FG |
252 | LL | let _: usize = X::bal(/* &X */); |
253 | | ++++++++++ | |
416331ca XL |
254 | |
255 | error[E0615]: attempted to take value of method `ban` on type `X` | |
256 | --> $DIR/fn-or-tuple-struct-without-args.rs:43:22 | |
257 | | | |
258 | LL | let _: usize = X.ban; | |
ba9703b0 XL |
259 | | ^^^ method, not a field |
260 | | | |
261 | help: use parentheses to call the method | |
262 | | | |
263 | LL | let _: usize = X.ban(); | |
94222f64 | 264 | | ++ |
416331ca XL |
265 | |
266 | error[E0615]: attempted to take value of method `bal` on type `X` | |
267 | --> $DIR/fn-or-tuple-struct-without-args.rs:44:22 | |
268 | | | |
269 | LL | let _: usize = X.bal; | |
ba9703b0 XL |
270 | | ^^^ method, not a field |
271 | | | |
272 | help: use parentheses to call the method | |
273 | | | |
274 | LL | let _: usize = X.bal(); | |
94222f64 | 275 | | ++ |
416331ca | 276 | |
e1599b0c XL |
277 | error[E0308]: mismatched types |
278 | --> $DIR/fn-or-tuple-struct-without-args.rs:46:20 | |
279 | | | |
280 | LL | let closure = || 42; | |
064997fb | 281 | | -- the found closure |
e1599b0c | 282 | LL | let _: usize = closure; |
ba9703b0 XL |
283 | | ----- ^^^^^^^ expected `usize`, found closure |
284 | | | | |
60c5eb7d | 285 | | expected due to this |
e1599b0c XL |
286 | | |
287 | = note: expected type `usize` | |
064997fb | 288 | found closure `[closure@$DIR/fn-or-tuple-struct-without-args.rs:45:19: 45:21]` |
ba9703b0 XL |
289 | help: use parentheses to call this closure |
290 | | | |
291 | LL | let _: usize = closure(); | |
94222f64 | 292 | | ++ |
e1599b0c XL |
293 | |
294 | error: aborting due to 17 previous errors | |
416331ca XL |
295 | |
296 | Some errors have detailed explanations: E0308, E0423, E0615. | |
297 | For more information about an error, try `rustc --explain E0308`. |