]>
Commit | Line | Data |
---|---|---|
064997fb | 1 | error: cast cannot be followed by indexing |
74b04a01 XL |
2 | --> $DIR/issue-35813-postfix-after-cast.rs:10:5 |
3 | | | |
4 | LL | vec![1, 2, 3] as Vec<i32>[0]; | |
5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ | |
6 | | | |
7 | help: try surrounding the expression in parentheses | |
8 | | | |
9 | LL | (vec![1, 2, 3] as Vec<i32>)[0]; | |
94222f64 | 10 | | + + |
74b04a01 | 11 | |
064997fb | 12 | error: type ascription cannot be followed by indexing |
74b04a01 XL |
13 | --> $DIR/issue-35813-postfix-after-cast.rs:12:5 |
14 | | | |
15 | LL | vec![1, 2, 3]: Vec<i32>[0]; | |
16 | | ^^^^^^^^^^^^^^^^^^^^^^^ | |
17 | | | |
18 | help: try surrounding the expression in parentheses | |
19 | | | |
20 | LL | (vec![1, 2, 3]: Vec<i32>)[0]; | |
94222f64 | 21 | | + + |
5e7ed085 FG |
22 | help: alternatively, remove the type ascription |
23 | | | |
24 | LL - vec![1, 2, 3]: Vec<i32>[0]; | |
25 | LL + vec![1, 2, 3][0]; | |
923072b8 | 26 | | |
74b04a01 | 27 | |
064997fb | 28 | error: cast cannot be followed by indexing |
74b04a01 XL |
29 | --> $DIR/issue-35813-postfix-after-cast.rs:17:5 |
30 | | | |
31 | LL | (&[0]) as &[i32][0]; | |
32 | | ^^^^^^^^^^^^^^^^ | |
33 | | | |
34 | help: try surrounding the expression in parentheses | |
35 | | | |
36 | LL | ((&[0]) as &[i32])[0]; | |
94222f64 | 37 | | + + |
74b04a01 | 38 | |
064997fb | 39 | error: type ascription cannot be followed by indexing |
74b04a01 XL |
40 | --> $DIR/issue-35813-postfix-after-cast.rs:19:5 |
41 | | | |
42 | LL | (&[0i32]): &[i32; 1][0]; | |
43 | | ^^^^^^^^^^^^^^^^^^^^ | |
44 | | | |
45 | help: try surrounding the expression in parentheses | |
46 | | | |
47 | LL | ((&[0i32]): &[i32; 1])[0]; | |
94222f64 | 48 | | + + |
5e7ed085 FG |
49 | help: alternatively, remove the type ascription |
50 | | | |
51 | LL - (&[0i32]): &[i32; 1][0]; | |
52 | LL + (&[0i32])[0]; | |
923072b8 | 53 | | |
74b04a01 | 54 | |
064997fb | 55 | error: type ascription cannot be followed by a method call |
74b04a01 XL |
56 | --> $DIR/issue-35813-postfix-after-cast.rs:39:13 |
57 | | | |
58 | LL | let _ = 0i32: i32: i32.count_ones(); | |
59 | | ^^^^^^^^^^^^^^ | |
60 | | | |
61 | help: try surrounding the expression in parentheses | |
62 | | | |
63 | LL | let _ = (0i32: i32: i32).count_ones(); | |
94222f64 | 64 | | + + |
5e7ed085 FG |
65 | help: alternatively, remove the type ascription |
66 | | | |
67 | LL - let _ = 0i32: i32: i32.count_ones(); | |
68 | LL + let _ = 0i32: i32.count_ones(); | |
923072b8 | 69 | | |
74b04a01 | 70 | |
064997fb | 71 | error: type ascription cannot be followed by a method call |
74b04a01 XL |
72 | --> $DIR/issue-35813-postfix-after-cast.rs:41:13 |
73 | | | |
74 | LL | let _ = 0 as i32: i32.count_ones(); | |
75 | | ^^^^^^^^^^^^^ | |
76 | | | |
77 | help: try surrounding the expression in parentheses | |
78 | | | |
79 | LL | let _ = (0 as i32: i32).count_ones(); | |
94222f64 | 80 | | + + |
5e7ed085 FG |
81 | help: alternatively, remove the type ascription |
82 | | | |
83 | LL - let _ = 0 as i32: i32.count_ones(); | |
84 | LL + let _ = 0 as i32.count_ones(); | |
923072b8 | 85 | | |
74b04a01 | 86 | |
064997fb | 87 | error: cast cannot be followed by a method call |
74b04a01 XL |
88 | --> $DIR/issue-35813-postfix-after-cast.rs:43:13 |
89 | | | |
90 | LL | let _ = 0i32: i32 as i32.count_ones(); | |
91 | | ^^^^^^^^^^^^^^^^ | |
92 | | | |
93 | help: try surrounding the expression in parentheses | |
94 | | | |
95 | LL | let _ = (0i32: i32 as i32).count_ones(); | |
94222f64 | 96 | | + + |
74b04a01 | 97 | |
064997fb | 98 | error: cast cannot be followed by a method call |
74b04a01 XL |
99 | --> $DIR/issue-35813-postfix-after-cast.rs:45:13 |
100 | | | |
101 | LL | let _ = 0 as i32 as i32.count_ones(); | |
102 | | ^^^^^^^^^^^^^^^ | |
103 | | | |
104 | help: try surrounding the expression in parentheses | |
105 | | | |
106 | LL | let _ = (0 as i32 as i32).count_ones(); | |
94222f64 | 107 | | + + |
74b04a01 | 108 | |
064997fb | 109 | error: cast cannot be followed by a method call |
74b04a01 XL |
110 | --> $DIR/issue-35813-postfix-after-cast.rs:47:13 |
111 | | | |
112 | LL | let _ = 0i32: i32: i32 as u32 as i32.count_ones(); | |
113 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
114 | | | |
115 | help: try surrounding the expression in parentheses | |
116 | | | |
117 | LL | let _ = (0i32: i32: i32 as u32 as i32).count_ones(); | |
94222f64 | 118 | | + + |
74b04a01 | 119 | |
064997fb | 120 | error: type ascription cannot be followed by a method call |
74b04a01 XL |
121 | --> $DIR/issue-35813-postfix-after-cast.rs:49:13 |
122 | | | |
123 | LL | let _ = 0i32: i32.count_ones(): u32; | |
124 | | ^^^^^^^^^ | |
125 | | | |
126 | help: try surrounding the expression in parentheses | |
127 | | | |
128 | LL | let _ = (0i32: i32).count_ones(): u32; | |
94222f64 | 129 | | + + |
5e7ed085 FG |
130 | help: alternatively, remove the type ascription |
131 | | | |
132 | LL - let _ = 0i32: i32.count_ones(): u32; | |
133 | LL + let _ = 0i32.count_ones(): u32; | |
923072b8 | 134 | | |
74b04a01 | 135 | |
064997fb | 136 | error: cast cannot be followed by a method call |
74b04a01 XL |
137 | --> $DIR/issue-35813-postfix-after-cast.rs:51:13 |
138 | | | |
139 | LL | let _ = 0 as i32.count_ones(): u32; | |
140 | | ^^^^^^^^ | |
141 | | | |
142 | help: try surrounding the expression in parentheses | |
143 | | | |
144 | LL | let _ = (0 as i32).count_ones(): u32; | |
94222f64 | 145 | | + + |
74b04a01 | 146 | |
064997fb | 147 | error: type ascription cannot be followed by a method call |
74b04a01 XL |
148 | --> $DIR/issue-35813-postfix-after-cast.rs:53:13 |
149 | | | |
150 | LL | let _ = 0i32: i32.count_ones() as u32; | |
151 | | ^^^^^^^^^ | |
152 | | | |
153 | help: try surrounding the expression in parentheses | |
154 | | | |
155 | LL | let _ = (0i32: i32).count_ones() as u32; | |
94222f64 | 156 | | + + |
5e7ed085 FG |
157 | help: alternatively, remove the type ascription |
158 | | | |
159 | LL - let _ = 0i32: i32.count_ones() as u32; | |
160 | LL + let _ = 0i32.count_ones() as u32; | |
923072b8 | 161 | | |
74b04a01 | 162 | |
064997fb | 163 | error: cast cannot be followed by a method call |
74b04a01 XL |
164 | --> $DIR/issue-35813-postfix-after-cast.rs:55:13 |
165 | | | |
166 | LL | let _ = 0 as i32.count_ones() as u32; | |
167 | | ^^^^^^^^ | |
168 | | | |
169 | help: try surrounding the expression in parentheses | |
170 | | | |
171 | LL | let _ = (0 as i32).count_ones() as u32; | |
94222f64 | 172 | | + + |
74b04a01 | 173 | |
064997fb | 174 | error: type ascription cannot be followed by a method call |
74b04a01 XL |
175 | --> $DIR/issue-35813-postfix-after-cast.rs:57:13 |
176 | | | |
177 | LL | let _ = 0i32: i32: i32.count_ones() as u32 as i32; | |
178 | | ^^^^^^^^^^^^^^ | |
179 | | | |
180 | help: try surrounding the expression in parentheses | |
181 | | | |
182 | LL | let _ = (0i32: i32: i32).count_ones() as u32 as i32; | |
94222f64 | 183 | | + + |
5e7ed085 FG |
184 | help: alternatively, remove the type ascription |
185 | | | |
186 | LL - let _ = 0i32: i32: i32.count_ones() as u32 as i32; | |
187 | LL + let _ = 0i32: i32.count_ones() as u32 as i32; | |
923072b8 | 188 | | |
74b04a01 | 189 | |
064997fb | 190 | error: cast cannot be followed by a method call |
74b04a01 XL |
191 | --> $DIR/issue-35813-postfix-after-cast.rs:62:13 |
192 | | | |
193 | LL | let _ = 0 | |
194 | | _____________^ | |
195 | LL | | as i32 | |
196 | | |______________^ | |
197 | | | |
198 | help: try surrounding the expression in parentheses | |
199 | | | |
94222f64 XL |
200 | LL ~ let _ = (0 |
201 | LL ~ as i32) | |
74b04a01 XL |
202 | | |
203 | ||
064997fb | 204 | error: cast cannot be followed by indexing |
74b04a01 XL |
205 | --> $DIR/issue-35813-postfix-after-cast.rs:70:18 |
206 | | | |
207 | LL | let x: i32 = &vec![1, 2, 3] as &Vec<i32>[0]; | |
208 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
209 | | | |
210 | help: try surrounding the expression in parentheses | |
211 | | | |
212 | LL | let x: i32 = (&vec![1, 2, 3] as &Vec<i32>)[0]; | |
94222f64 | 213 | | + + |
74b04a01 | 214 | |
064997fb | 215 | error: cast cannot be followed by a method call |
74b04a01 XL |
216 | --> $DIR/issue-35813-postfix-after-cast.rs:75:5 |
217 | | | |
218 | LL | 0 as i32.max(0); | |
219 | | ^^^^^^^^ | |
220 | | | |
221 | help: try surrounding the expression in parentheses | |
222 | | | |
223 | LL | (0 as i32).max(0); | |
94222f64 | 224 | | + + |
74b04a01 | 225 | |
064997fb | 226 | error: type ascription cannot be followed by a method call |
74b04a01 XL |
227 | --> $DIR/issue-35813-postfix-after-cast.rs:77:5 |
228 | | | |
229 | LL | 0: i32.max(0); | |
230 | | ^^^^^^ | |
231 | | | |
232 | help: try surrounding the expression in parentheses | |
233 | | | |
234 | LL | (0: i32).max(0); | |
94222f64 | 235 | | + + |
5e7ed085 FG |
236 | help: alternatively, remove the type ascription |
237 | | | |
238 | LL - 0: i32.max(0); | |
239 | LL + 0.max(0); | |
923072b8 | 240 | | |
74b04a01 | 241 | |
064997fb | 242 | error: cast cannot be followed by a method call |
74b04a01 XL |
243 | --> $DIR/issue-35813-postfix-after-cast.rs:92:8 |
244 | | | |
245 | LL | if 5u64 as i32.max(0) == 0 { | |
246 | | ^^^^^^^^^^^ | |
247 | | | |
248 | help: try surrounding the expression in parentheses | |
249 | | | |
250 | LL | if (5u64 as i32).max(0) == 0 { | |
94222f64 | 251 | | + + |
74b04a01 | 252 | |
064997fb | 253 | error: type ascription cannot be followed by a method call |
74b04a01 XL |
254 | --> $DIR/issue-35813-postfix-after-cast.rs:95:8 |
255 | | | |
256 | LL | if 5u64: u64.max(0) == 0 { | |
257 | | ^^^^^^^^^ | |
258 | | | |
259 | help: try surrounding the expression in parentheses | |
260 | | | |
261 | LL | if (5u64: u64).max(0) == 0 { | |
94222f64 | 262 | | + + |
5e7ed085 FG |
263 | help: alternatively, remove the type ascription |
264 | | | |
265 | LL - if 5u64: u64.max(0) == 0 { | |
266 | LL + if 5u64.max(0) == 0 { | |
923072b8 | 267 | | |
74b04a01 | 268 | |
064997fb | 269 | error: cast cannot be followed by a method call |
74b04a01 XL |
270 | --> $DIR/issue-35813-postfix-after-cast.rs:102:9 |
271 | | | |
272 | LL | 5u64 as u32.max(0) == 0 | |
273 | | ^^^^^^^^^^^ | |
274 | | | |
275 | help: try surrounding the expression in parentheses | |
276 | | | |
277 | LL | (5u64 as u32).max(0) == 0 | |
94222f64 | 278 | | + + |
74b04a01 | 279 | |
064997fb | 280 | error: type ascription cannot be followed by a method call |
74b04a01 XL |
281 | --> $DIR/issue-35813-postfix-after-cast.rs:106:9 |
282 | | | |
283 | LL | 5u64: u64.max(0) == 0 | |
284 | | ^^^^^^^^^ | |
285 | | | |
286 | help: try surrounding the expression in parentheses | |
287 | | | |
288 | LL | (5u64: u64).max(0) == 0 | |
94222f64 | 289 | | + + |
5e7ed085 FG |
290 | help: alternatively, remove the type ascription |
291 | | | |
292 | LL - 5u64: u64.max(0) == 0 | |
293 | LL + 5u64.max(0) == 0 | |
923072b8 | 294 | | |
74b04a01 | 295 | |
064997fb | 296 | error: cast cannot be followed by indexing |
74b04a01 XL |
297 | --> $DIR/issue-35813-postfix-after-cast.rs:111:24 |
298 | | | |
299 | LL | static bar: &[i32] = &(&[1,2,3] as &[i32][0..1]); | |
300 | | ^^^^^^^^^^^^^^^^^^ | |
301 | | | |
302 | help: try surrounding the expression in parentheses | |
303 | | | |
304 | LL | static bar: &[i32] = &((&[1,2,3] as &[i32])[0..1]); | |
94222f64 | 305 | | + + |
74b04a01 | 306 | |
064997fb | 307 | error: type ascription cannot be followed by indexing |
74b04a01 XL |
308 | --> $DIR/issue-35813-postfix-after-cast.rs:114:25 |
309 | | | |
310 | LL | static bar2: &[i32] = &(&[1i32,2,3]: &[i32; 3][0..1]); | |
311 | | ^^^^^^^^^^^^^^^^^^^^^^ | |
312 | | | |
313 | help: try surrounding the expression in parentheses | |
314 | | | |
315 | LL | static bar2: &[i32] = &((&[1i32,2,3]: &[i32; 3])[0..1]); | |
94222f64 | 316 | | + + |
5e7ed085 FG |
317 | help: alternatively, remove the type ascription |
318 | | | |
319 | LL - static bar2: &[i32] = &(&[1i32,2,3]: &[i32; 3][0..1]); | |
320 | LL + static bar2: &[i32] = &(&[1i32,2,3][0..1]); | |
923072b8 | 321 | | |
74b04a01 | 322 | |
064997fb | 323 | error: cast cannot be followed by `?` |
74b04a01 XL |
324 | --> $DIR/issue-35813-postfix-after-cast.rs:119:5 |
325 | | | |
326 | LL | Err(0u64) as Result<u64,u64>?; | |
327 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
328 | | | |
329 | help: try surrounding the expression in parentheses | |
330 | | | |
331 | LL | (Err(0u64) as Result<u64,u64>)?; | |
94222f64 | 332 | | + + |
74b04a01 | 333 | |
064997fb | 334 | error: type ascription cannot be followed by `?` |
74b04a01 XL |
335 | --> $DIR/issue-35813-postfix-after-cast.rs:121:5 |
336 | | | |
337 | LL | Err(0u64): Result<u64,u64>?; | |
f035d41b | 338 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^ |
74b04a01 | 339 | | |
f035d41b XL |
340 | help: try surrounding the expression in parentheses |
341 | | | |
342 | LL | (Err(0u64): Result<u64,u64>)?; | |
94222f64 | 343 | | + + |
5e7ed085 FG |
344 | help: alternatively, remove the type ascription |
345 | | | |
346 | LL - Err(0u64): Result<u64,u64>?; | |
347 | LL + Err(0u64)?; | |
923072b8 | 348 | | |
74b04a01 | 349 | |
064997fb | 350 | error: cast cannot be followed by a function call |
74b04a01 XL |
351 | --> $DIR/issue-35813-postfix-after-cast.rs:145:5 |
352 | | | |
353 | LL | drop as fn(u8)(0); | |
354 | | ^^^^^^^^^^^^^^ | |
355 | | | |
356 | help: try surrounding the expression in parentheses | |
357 | | | |
358 | LL | (drop as fn(u8))(0); | |
94222f64 | 359 | | + + |
74b04a01 | 360 | |
064997fb | 361 | error: type ascription cannot be followed by a function call |
74b04a01 XL |
362 | --> $DIR/issue-35813-postfix-after-cast.rs:147:5 |
363 | | | |
364 | LL | drop_ptr: fn(u8)(0); | |
365 | | ^^^^^^^^^^^^^^^^ | |
366 | | | |
367 | help: try surrounding the expression in parentheses | |
368 | | | |
369 | LL | (drop_ptr: fn(u8))(0); | |
94222f64 | 370 | | + + |
5e7ed085 FG |
371 | help: alternatively, remove the type ascription |
372 | | | |
373 | LL - drop_ptr: fn(u8)(0); | |
374 | LL + drop_ptr(0); | |
923072b8 | 375 | | |
74b04a01 | 376 | |
064997fb | 377 | error: cast cannot be followed by `.await` |
74b04a01 XL |
378 | --> $DIR/issue-35813-postfix-after-cast.rs:152:5 |
379 | | | |
380 | LL | Box::pin(noop()) as Pin<Box<dyn Future<Output = ()>>>.await; | |
381 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
382 | | | |
383 | help: try surrounding the expression in parentheses | |
384 | | | |
385 | LL | (Box::pin(noop()) as Pin<Box<dyn Future<Output = ()>>>).await; | |
94222f64 | 386 | | + + |
74b04a01 | 387 | |
064997fb | 388 | error: type ascription cannot be followed by `.await` |
74b04a01 XL |
389 | --> $DIR/issue-35813-postfix-after-cast.rs:155:5 |
390 | | | |
391 | LL | Box::pin(noop()): Pin<Box<_>>.await; | |
f035d41b XL |
392 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
393 | | | |
394 | help: try surrounding the expression in parentheses | |
74b04a01 | 395 | | |
f035d41b | 396 | LL | (Box::pin(noop()): Pin<Box<_>>).await; |
94222f64 | 397 | | + + |
5e7ed085 FG |
398 | help: alternatively, remove the type ascription |
399 | | | |
400 | LL - Box::pin(noop()): Pin<Box<_>>.await; | |
401 | LL + Box::pin(noop()).await; | |
923072b8 | 402 | | |
74b04a01 | 403 | |
064997fb | 404 | error: cast cannot be followed by a field access |
74b04a01 XL |
405 | --> $DIR/issue-35813-postfix-after-cast.rs:167:5 |
406 | | | |
407 | LL | Foo::default() as Foo.bar; | |
408 | | ^^^^^^^^^^^^^^^^^^^^^ | |
409 | | | |
410 | help: try surrounding the expression in parentheses | |
411 | | | |
412 | LL | (Foo::default() as Foo).bar; | |
94222f64 | 413 | | + + |
74b04a01 | 414 | |
064997fb | 415 | error: type ascription cannot be followed by a field access |
74b04a01 XL |
416 | --> $DIR/issue-35813-postfix-after-cast.rs:169:5 |
417 | | | |
418 | LL | Foo::default(): Foo.bar; | |
419 | | ^^^^^^^^^^^^^^^^^^^ | |
420 | | | |
421 | help: try surrounding the expression in parentheses | |
422 | | | |
423 | LL | (Foo::default(): Foo).bar; | |
94222f64 | 424 | | + + |
5e7ed085 FG |
425 | help: alternatively, remove the type ascription |
426 | | | |
427 | LL - Foo::default(): Foo.bar; | |
428 | LL + Foo::default().bar; | |
923072b8 | 429 | | |
74b04a01 | 430 | |
064997fb | 431 | error: cast cannot be followed by a method call |
74b04a01 XL |
432 | --> $DIR/issue-35813-postfix-after-cast.rs:84:9 |
433 | | | |
434 | LL | if true { 33 } else { 44 } as i32.max(0), | |
435 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
436 | | | |
437 | help: try surrounding the expression in parentheses | |
438 | | | |
439 | LL | (if true { 33 } else { 44 } as i32).max(0), | |
94222f64 | 440 | | + + |
74b04a01 | 441 | |
064997fb | 442 | error: type ascription cannot be followed by a method call |
74b04a01 XL |
443 | --> $DIR/issue-35813-postfix-after-cast.rs:86:9 |
444 | | | |
445 | LL | if true { 33 } else { 44 }: i32.max(0) | |
446 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
447 | | | |
448 | help: try surrounding the expression in parentheses | |
449 | | | |
450 | LL | (if true { 33 } else { 44 }: i32).max(0) | |
94222f64 | 451 | | + + |
5e7ed085 FG |
452 | help: alternatively, remove the type ascription |
453 | | | |
454 | LL - if true { 33 } else { 44 }: i32.max(0) | |
455 | LL + if true { 33 } else { 44 }.max(0) | |
923072b8 | 456 | | |
74b04a01 XL |
457 | |
458 | error[E0214]: parenthesized type parameters may only be used with a `Fn` trait | |
459 | --> $DIR/issue-35813-postfix-after-cast.rs:131:13 | |
460 | | | |
461 | LL | drop as F(); | |
462 | | ^^^ only `Fn` traits may use parentheses | |
463 | ||
464 | error[E0214]: parenthesized type parameters may only be used with a `Fn` trait | |
465 | --> $DIR/issue-35813-postfix-after-cast.rs:133:15 | |
466 | | | |
467 | LL | drop_ptr: F(); | |
468 | | ^^^ only `Fn` traits may use parentheses | |
469 | ||
470 | error: aborting due to 36 previous errors | |
471 | ||
472 | For more information about this error, try `rustc --explain E0214`. |