1 error: cast cannot be followed by indexing
2 --> $DIR/issue-35813-postfix-after-cast.rs:10:5
4 LL | vec![1, 2, 3] as Vec<i32>[0];
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^
7 help: try surrounding the expression in parentheses
9 LL | (vec![1, 2, 3] as Vec<i32>)[0];
12 error: type ascription cannot be followed by indexing
13 --> $DIR/issue-35813-postfix-after-cast.rs:12:5
15 LL | vec![1, 2, 3]: Vec<i32>[0];
16 | ^^^^^^^^^^^^^^^^^^^^^^^
18 help: try surrounding the expression in parentheses
20 LL | (vec![1, 2, 3]: Vec<i32>)[0];
22 help: alternatively, remove the type ascription
24 LL - vec![1, 2, 3]: Vec<i32>[0];
25 LL + vec![1, 2, 3][0];
28 error: cast cannot be followed by indexing
29 --> $DIR/issue-35813-postfix-after-cast.rs:17:5
31 LL | (&[0]) as &[i32][0];
34 help: try surrounding the expression in parentheses
36 LL | ((&[0]) as &[i32])[0];
39 error: type ascription cannot be followed by indexing
40 --> $DIR/issue-35813-postfix-after-cast.rs:19:5
42 LL | (&[0i32]): &[i32; 1][0];
43 | ^^^^^^^^^^^^^^^^^^^^
45 help: try surrounding the expression in parentheses
47 LL | ((&[0i32]): &[i32; 1])[0];
49 help: alternatively, remove the type ascription
51 LL - (&[0i32]): &[i32; 1][0];
55 error: type ascription cannot be followed by a method call
56 --> $DIR/issue-35813-postfix-after-cast.rs:39:13
58 LL | let _ = 0i32: i32: i32.count_ones();
61 help: try surrounding the expression in parentheses
63 LL | let _ = (0i32: i32: i32).count_ones();
65 help: alternatively, remove the type ascription
67 LL - let _ = 0i32: i32: i32.count_ones();
68 LL + let _ = 0i32: i32.count_ones();
71 error: type ascription cannot be followed by a method call
72 --> $DIR/issue-35813-postfix-after-cast.rs:41:13
74 LL | let _ = 0 as i32: i32.count_ones();
77 help: try surrounding the expression in parentheses
79 LL | let _ = (0 as i32: i32).count_ones();
81 help: alternatively, remove the type ascription
83 LL - let _ = 0 as i32: i32.count_ones();
84 LL + let _ = 0 as i32.count_ones();
87 error: cast cannot be followed by a method call
88 --> $DIR/issue-35813-postfix-after-cast.rs:43:13
90 LL | let _ = 0i32: i32 as i32.count_ones();
93 help: try surrounding the expression in parentheses
95 LL | let _ = (0i32: i32 as i32).count_ones();
98 error: cast cannot be followed by a method call
99 --> $DIR/issue-35813-postfix-after-cast.rs:45:13
101 LL | let _ = 0 as i32 as i32.count_ones();
104 help: try surrounding the expression in parentheses
106 LL | let _ = (0 as i32 as i32).count_ones();
109 error: cast cannot be followed by a method call
110 --> $DIR/issue-35813-postfix-after-cast.rs:47:13
112 LL | let _ = 0i32: i32: i32 as u32 as i32.count_ones();
113 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
115 help: try surrounding the expression in parentheses
117 LL | let _ = (0i32: i32: i32 as u32 as i32).count_ones();
120 error: type ascription cannot be followed by a method call
121 --> $DIR/issue-35813-postfix-after-cast.rs:49:13
123 LL | let _ = 0i32: i32.count_ones(): u32;
126 help: try surrounding the expression in parentheses
128 LL | let _ = (0i32: i32).count_ones(): u32;
130 help: alternatively, remove the type ascription
132 LL - let _ = 0i32: i32.count_ones(): u32;
133 LL + let _ = 0i32.count_ones(): u32;
136 error: cast cannot be followed by a method call
137 --> $DIR/issue-35813-postfix-after-cast.rs:51:13
139 LL | let _ = 0 as i32.count_ones(): u32;
142 help: try surrounding the expression in parentheses
144 LL | let _ = (0 as i32).count_ones(): u32;
147 error: type ascription cannot be followed by a method call
148 --> $DIR/issue-35813-postfix-after-cast.rs:53:13
150 LL | let _ = 0i32: i32.count_ones() as u32;
153 help: try surrounding the expression in parentheses
155 LL | let _ = (0i32: i32).count_ones() as u32;
157 help: alternatively, remove the type ascription
159 LL - let _ = 0i32: i32.count_ones() as u32;
160 LL + let _ = 0i32.count_ones() as u32;
163 error: cast cannot be followed by a method call
164 --> $DIR/issue-35813-postfix-after-cast.rs:55:13
166 LL | let _ = 0 as i32.count_ones() as u32;
169 help: try surrounding the expression in parentheses
171 LL | let _ = (0 as i32).count_ones() as u32;
174 error: type ascription cannot be followed by a method call
175 --> $DIR/issue-35813-postfix-after-cast.rs:57:13
177 LL | let _ = 0i32: i32: i32.count_ones() as u32 as i32;
180 help: try surrounding the expression in parentheses
182 LL | let _ = (0i32: i32: i32).count_ones() as u32 as i32;
184 help: alternatively, remove the type ascription
186 LL - let _ = 0i32: i32: i32.count_ones() as u32 as i32;
187 LL + let _ = 0i32: i32.count_ones() as u32 as i32;
190 error: cast cannot be followed by a method call
191 --> $DIR/issue-35813-postfix-after-cast.rs:62:13
198 help: try surrounding the expression in parentheses
204 error: cast cannot be followed by indexing
205 --> $DIR/issue-35813-postfix-after-cast.rs:70:18
207 LL | let x: i32 = &vec![1, 2, 3] as &Vec<i32>[0];
208 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
210 help: try surrounding the expression in parentheses
212 LL | let x: i32 = (&vec![1, 2, 3] as &Vec<i32>)[0];
215 error: cast cannot be followed by a method call
216 --> $DIR/issue-35813-postfix-after-cast.rs:75:5
218 LL | 0 as i32.max(0);
221 help: try surrounding the expression in parentheses
223 LL | (0 as i32).max(0);
226 error: type ascription cannot be followed by a method call
227 --> $DIR/issue-35813-postfix-after-cast.rs:77:5
232 help: try surrounding the expression in parentheses
234 LL | (0: i32).max(0);
236 help: alternatively, remove the type ascription
242 error: cast cannot be followed by a method call
243 --> $DIR/issue-35813-postfix-after-cast.rs:92:8
245 LL | if 5u64 as i32.max(0) == 0 {
248 help: try surrounding the expression in parentheses
250 LL | if (5u64 as i32).max(0) == 0 {
253 error: type ascription cannot be followed by a method call
254 --> $DIR/issue-35813-postfix-after-cast.rs:95:8
256 LL | if 5u64: u64.max(0) == 0 {
259 help: try surrounding the expression in parentheses
261 LL | if (5u64: u64).max(0) == 0 {
263 help: alternatively, remove the type ascription
265 LL - if 5u64: u64.max(0) == 0 {
266 LL + if 5u64.max(0) == 0 {
269 error: cast cannot be followed by a method call
270 --> $DIR/issue-35813-postfix-after-cast.rs:102:9
272 LL | 5u64 as u32.max(0) == 0
275 help: try surrounding the expression in parentheses
277 LL | (5u64 as u32).max(0) == 0
280 error: type ascription cannot be followed by a method call
281 --> $DIR/issue-35813-postfix-after-cast.rs:106:9
283 LL | 5u64: u64.max(0) == 0
286 help: try surrounding the expression in parentheses
288 LL | (5u64: u64).max(0) == 0
290 help: alternatively, remove the type ascription
292 LL - 5u64: u64.max(0) == 0
293 LL + 5u64.max(0) == 0
296 error: cast cannot be followed by indexing
297 --> $DIR/issue-35813-postfix-after-cast.rs:111:24
299 LL | static bar: &[i32] = &(&[1,2,3] as &[i32][0..1]);
302 help: try surrounding the expression in parentheses
304 LL | static bar: &[i32] = &((&[1,2,3] as &[i32])[0..1]);
307 error: type ascription cannot be followed by indexing
308 --> $DIR/issue-35813-postfix-after-cast.rs:114:25
310 LL | static bar2: &[i32] = &(&[1i32,2,3]: &[i32; 3][0..1]);
311 | ^^^^^^^^^^^^^^^^^^^^^^
313 help: try surrounding the expression in parentheses
315 LL | static bar2: &[i32] = &((&[1i32,2,3]: &[i32; 3])[0..1]);
317 help: alternatively, remove the type ascription
319 LL - static bar2: &[i32] = &(&[1i32,2,3]: &[i32; 3][0..1]);
320 LL + static bar2: &[i32] = &(&[1i32,2,3][0..1]);
323 error: cast cannot be followed by `?`
324 --> $DIR/issue-35813-postfix-after-cast.rs:119:5
326 LL | Err(0u64) as Result<u64,u64>?;
327 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
329 help: try surrounding the expression in parentheses
331 LL | (Err(0u64) as Result<u64,u64>)?;
334 error: type ascription cannot be followed by `?`
335 --> $DIR/issue-35813-postfix-after-cast.rs:121:5
337 LL | Err(0u64): Result<u64,u64>?;
338 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
340 help: try surrounding the expression in parentheses
342 LL | (Err(0u64): Result<u64,u64>)?;
344 help: alternatively, remove the type ascription
346 LL - Err(0u64): Result<u64,u64>?;
350 error: cast cannot be followed by a function call
351 --> $DIR/issue-35813-postfix-after-cast.rs:145:5
353 LL | drop as fn(u8)(0);
356 help: try surrounding the expression in parentheses
358 LL | (drop as fn(u8))(0);
361 error: type ascription cannot be followed by a function call
362 --> $DIR/issue-35813-postfix-after-cast.rs:147:5
364 LL | drop_ptr: fn(u8)(0);
367 help: try surrounding the expression in parentheses
369 LL | (drop_ptr: fn(u8))(0);
371 help: alternatively, remove the type ascription
373 LL - drop_ptr: fn(u8)(0);
377 error: cast cannot be followed by `.await`
378 --> $DIR/issue-35813-postfix-after-cast.rs:152:5
380 LL | Box::pin(noop()) as Pin<Box<dyn Future<Output = ()>>>.await;
381 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
383 help: try surrounding the expression in parentheses
385 LL | (Box::pin(noop()) as Pin<Box<dyn Future<Output = ()>>>).await;
388 error: type ascription cannot be followed by `.await`
389 --> $DIR/issue-35813-postfix-after-cast.rs:155:5
391 LL | Box::pin(noop()): Pin<Box<_>>.await;
392 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
394 help: try surrounding the expression in parentheses
396 LL | (Box::pin(noop()): Pin<Box<_>>).await;
398 help: alternatively, remove the type ascription
400 LL - Box::pin(noop()): Pin<Box<_>>.await;
401 LL + Box::pin(noop()).await;
404 error: cast cannot be followed by a field access
405 --> $DIR/issue-35813-postfix-after-cast.rs:167:5
407 LL | Foo::default() as Foo.bar;
408 | ^^^^^^^^^^^^^^^^^^^^^
410 help: try surrounding the expression in parentheses
412 LL | (Foo::default() as Foo).bar;
415 error: type ascription cannot be followed by a field access
416 --> $DIR/issue-35813-postfix-after-cast.rs:169:5
418 LL | Foo::default(): Foo.bar;
419 | ^^^^^^^^^^^^^^^^^^^
421 help: try surrounding the expression in parentheses
423 LL | (Foo::default(): Foo).bar;
425 help: alternatively, remove the type ascription
427 LL - Foo::default(): Foo.bar;
428 LL + Foo::default().bar;
431 error: cast cannot be followed by a method call
432 --> $DIR/issue-35813-postfix-after-cast.rs:84:9
434 LL | if true { 33 } else { 44 } as i32.max(0),
435 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
437 help: try surrounding the expression in parentheses
439 LL | (if true { 33 } else { 44 } as i32).max(0),
442 error: type ascription cannot be followed by a method call
443 --> $DIR/issue-35813-postfix-after-cast.rs:86:9
445 LL | if true { 33 } else { 44 }: i32.max(0)
446 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
448 help: try surrounding the expression in parentheses
450 LL | (if true { 33 } else { 44 }: i32).max(0)
452 help: alternatively, remove the type ascription
454 LL - if true { 33 } else { 44 }: i32.max(0)
455 LL + if true { 33 } else { 44 }.max(0)
458 error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
459 --> $DIR/issue-35813-postfix-after-cast.rs:131:13
462 | ^^^ only `Fn` traits may use parentheses
464 error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
465 --> $DIR/issue-35813-postfix-after-cast.rs:133:15
468 | ^^^ only `Fn` traits may use parentheses
470 error: aborting due to 36 previous errors
472 For more information about this error, try `rustc --explain E0214`.