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