fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

1.44.0
11.5 KiB392 linesraw
1error: casts cannot be followed by indexing
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];
10   |     ^                         ^
11
12error: casts cannot be followed by indexing
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];
21   |     ^                       ^
22
23error: casts cannot be followed by indexing
24  --> $DIR/issue-35813-postfix-after-cast.rs:17:5
25   |
26LL |     (&[0]) as &[i32][0];
27   |     ^^^^^^^^^^^^^^^^
28   |
29help: try surrounding the expression in parentheses
30   |
31LL |     ((&[0]) as &[i32])[0];
32   |     ^                ^
33
34error: casts cannot be followed by indexing
35  --> $DIR/issue-35813-postfix-after-cast.rs:19:5
36   |
37LL |     (&[0i32]): &[i32; 1][0];
38   |     ^^^^^^^^^^^^^^^^^^^^
39   |
40help: try surrounding the expression in parentheses
41   |
42LL |     ((&[0i32]): &[i32; 1])[0];
43   |     ^                    ^
44
45error: casts cannot be followed by a method call
46  --> $DIR/issue-35813-postfix-after-cast.rs:39:13
47   |
48LL |     let _ = 0i32: i32: i32.count_ones();
49   |             ^^^^^^^^^^^^^^
50   |
51help: try surrounding the expression in parentheses
52   |
53LL |     let _ = (0i32: i32: i32).count_ones();
54   |             ^              ^
55
56error: casts cannot be followed by a method call
57  --> $DIR/issue-35813-postfix-after-cast.rs:41:13
58   |
59LL |     let _ = 0 as i32: i32.count_ones();
60   |             ^^^^^^^^^^^^^
61   |
62help: try surrounding the expression in parentheses
63   |
64LL |     let _ = (0 as i32: i32).count_ones();
65   |             ^             ^
66
67error: casts cannot be followed by a method call
68  --> $DIR/issue-35813-postfix-after-cast.rs:43:13
69   |
70LL |     let _ = 0i32: i32 as i32.count_ones();
71   |             ^^^^^^^^^^^^^^^^
72   |
73help: try surrounding the expression in parentheses
74   |
75LL |     let _ = (0i32: i32 as i32).count_ones();
76   |             ^                ^
77
78error: casts cannot be followed by a method call
79  --> $DIR/issue-35813-postfix-after-cast.rs:45:13
80   |
81LL |     let _ = 0 as i32 as i32.count_ones();
82   |             ^^^^^^^^^^^^^^^
83   |
84help: try surrounding the expression in parentheses
85   |
86LL |     let _ = (0 as i32 as i32).count_ones();
87   |             ^               ^
88
89error: casts cannot be followed by a method call
90  --> $DIR/issue-35813-postfix-after-cast.rs:47:13
91   |
92LL |     let _ = 0i32: i32: i32 as u32 as i32.count_ones();
93   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
94   |
95help: try surrounding the expression in parentheses
96   |
97LL |     let _ = (0i32: i32: i32 as u32 as i32).count_ones();
98   |             ^                            ^
99
100error: casts cannot be followed by a method call
101  --> $DIR/issue-35813-postfix-after-cast.rs:49:13
102   |
103LL |     let _ = 0i32: i32.count_ones(): u32;
104   |             ^^^^^^^^^
105   |
106help: try surrounding the expression in parentheses
107   |
108LL |     let _ = (0i32: i32).count_ones(): u32;
109   |             ^         ^
110
111error: casts cannot be followed by a method call
112  --> $DIR/issue-35813-postfix-after-cast.rs:51:13
113   |
114LL |     let _ = 0 as i32.count_ones(): u32;
115   |             ^^^^^^^^
116   |
117help: try surrounding the expression in parentheses
118   |
119LL |     let _ = (0 as i32).count_ones(): u32;
120   |             ^        ^
121
122error: casts cannot be followed by a method call
123  --> $DIR/issue-35813-postfix-after-cast.rs:53:13
124   |
125LL |     let _ = 0i32: i32.count_ones() as u32;
126   |             ^^^^^^^^^
127   |
128help: try surrounding the expression in parentheses
129   |
130LL |     let _ = (0i32: i32).count_ones() as u32;
131   |             ^         ^
132
133error: casts cannot be followed by a method call
134  --> $DIR/issue-35813-postfix-after-cast.rs:55:13
135   |
136LL |     let _ = 0 as i32.count_ones() as u32;
137   |             ^^^^^^^^
138   |
139help: try surrounding the expression in parentheses
140   |
141LL |     let _ = (0 as i32).count_ones() as u32;
142   |             ^        ^
143
144error: casts cannot be followed by a method call
145  --> $DIR/issue-35813-postfix-after-cast.rs:57:13
146   |
147LL |     let _ = 0i32: i32: i32.count_ones() as u32 as i32;
148   |             ^^^^^^^^^^^^^^
149   |
150help: try surrounding the expression in parentheses
151   |
152LL |     let _ = (0i32: i32: i32).count_ones() as u32 as i32;
153   |             ^              ^
154
155error: casts cannot be followed by a method call
156  --> $DIR/issue-35813-postfix-after-cast.rs:62:13
157   |
158LL |       let _ = 0
159   |  _____________^
160LL | |         as i32
161   | |______________^
162   |
163help: try surrounding the expression in parentheses
164   |
165LL |     let _ = (0
166LL |         as i32)
167   |
168
169error: casts cannot be followed by indexing
170  --> $DIR/issue-35813-postfix-after-cast.rs:70:18
171   |
172LL |     let x: i32 = &vec![1, 2, 3] as &Vec<i32>[0];
173   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
174   |
175help: try surrounding the expression in parentheses
176   |
177LL |     let x: i32 = (&vec![1, 2, 3] as &Vec<i32>)[0];
178   |                  ^                           ^
179
180error: casts cannot be followed by a method call
181  --> $DIR/issue-35813-postfix-after-cast.rs:75:5
182   |
183LL |     0 as i32.max(0);
184   |     ^^^^^^^^
185   |
186help: try surrounding the expression in parentheses
187   |
188LL |     (0 as i32).max(0);
189   |     ^        ^
190
191error: casts cannot be followed by a method call
192  --> $DIR/issue-35813-postfix-after-cast.rs:77:5
193   |
194LL |     0: i32.max(0);
195   |     ^^^^^^
196   |
197help: try surrounding the expression in parentheses
198   |
199LL |     (0: i32).max(0);
200   |     ^      ^
201
202error: casts cannot be followed by a method call
203  --> $DIR/issue-35813-postfix-after-cast.rs:92:8
204   |
205LL |     if 5u64 as i32.max(0) == 0 {
206   |        ^^^^^^^^^^^
207   |
208help: try surrounding the expression in parentheses
209   |
210LL |     if (5u64 as i32).max(0) == 0 {
211   |        ^           ^
212
213error: casts cannot be followed by a method call
214  --> $DIR/issue-35813-postfix-after-cast.rs:95:8
215   |
216LL |     if 5u64: u64.max(0) == 0 {
217   |        ^^^^^^^^^
218   |
219help: try surrounding the expression in parentheses
220   |
221LL |     if (5u64: u64).max(0) == 0 {
222   |        ^         ^
223
224error: casts cannot be followed by a method call
225  --> $DIR/issue-35813-postfix-after-cast.rs:102:9
226   |
227LL |         5u64 as u32.max(0) == 0
228   |         ^^^^^^^^^^^
229   |
230help: try surrounding the expression in parentheses
231   |
232LL |         (5u64 as u32).max(0) == 0
233   |         ^           ^
234
235error: casts cannot be followed by a method call
236  --> $DIR/issue-35813-postfix-after-cast.rs:106:9
237   |
238LL |         5u64: u64.max(0) == 0
239   |         ^^^^^^^^^
240   |
241help: try surrounding the expression in parentheses
242   |
243LL |         (5u64: u64).max(0) == 0
244   |         ^         ^
245
246error: casts cannot be followed by indexing
247  --> $DIR/issue-35813-postfix-after-cast.rs:111:24
248   |
249LL | static bar: &[i32] = &(&[1,2,3] as &[i32][0..1]);
250   |                        ^^^^^^^^^^^^^^^^^^
251   |
252help: try surrounding the expression in parentheses
253   |
254LL | static bar: &[i32] = &((&[1,2,3] as &[i32])[0..1]);
255   |                        ^                  ^
256
257error: casts cannot be followed by indexing
258  --> $DIR/issue-35813-postfix-after-cast.rs:114:25
259   |
260LL | static bar2: &[i32] = &(&[1i32,2,3]: &[i32; 3][0..1]);
261   |                         ^^^^^^^^^^^^^^^^^^^^^^
262   |
263help: try surrounding the expression in parentheses
264   |
265LL | static bar2: &[i32] = &((&[1i32,2,3]: &[i32; 3])[0..1]);
266   |                         ^                      ^
267
268error: casts cannot be followed by ?
269  --> $DIR/issue-35813-postfix-after-cast.rs:119:5
270   |
271LL |     Err(0u64) as Result<u64,u64>?;
272   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
273   |
274help: try surrounding the expression in parentheses
275   |
276LL |     (Err(0u64) as Result<u64,u64>)?;
277   |     ^                            ^
278
279error: casts cannot be followed by ?
280  --> $DIR/issue-35813-postfix-after-cast.rs:121:5
281   |
282LL |     Err(0u64): Result<u64,u64>?;
283   |     ^^^^^^^^^-^^^^^^^^^^^^^^^^
284   |              |
285   |              help: maybe write a path separator here: `::`
286   |
287   = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `<expr>: <type>`
288   = note: see issue #23416 <https://github.com/rust-lang/rust/issues/23416> for more information
289
290error: casts cannot be followed by a function call
291  --> $DIR/issue-35813-postfix-after-cast.rs:145:5
292   |
293LL |     drop as fn(u8)(0);
294   |     ^^^^^^^^^^^^^^
295   |
296help: try surrounding the expression in parentheses
297   |
298LL |     (drop as fn(u8))(0);
299   |     ^              ^
300
301error: casts cannot be followed by a function call
302  --> $DIR/issue-35813-postfix-after-cast.rs:147:5
303   |
304LL |     drop_ptr: fn(u8)(0);
305   |     ^^^^^^^^^^^^^^^^
306   |
307help: try surrounding the expression in parentheses
308   |
309LL |     (drop_ptr: fn(u8))(0);
310   |     ^                ^
311
312error: casts cannot be followed by `.await`
313  --> $DIR/issue-35813-postfix-after-cast.rs:152:5
314   |
315LL |     Box::pin(noop()) as Pin<Box<dyn Future<Output = ()>>>.await;
316   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
317   |
318help: try surrounding the expression in parentheses
319   |
320LL |     (Box::pin(noop()) as Pin<Box<dyn Future<Output = ()>>>).await;
321   |     ^                                                     ^
322
323error: casts cannot be followed by `.await`
324  --> $DIR/issue-35813-postfix-after-cast.rs:155:5
325   |
326LL |     Box::pin(noop()): Pin<Box<_>>.await;
327   |     ^^^^^^^^^^^^^^^^-^^^^^^^^^^^^
328   |                     |
329   |                     help: maybe write a path separator here: `::`
330   |
331   = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `<expr>: <type>`
332   = note: see issue #23416 <https://github.com/rust-lang/rust/issues/23416> for more information
333
334error: casts cannot be followed by a field access
335  --> $DIR/issue-35813-postfix-after-cast.rs:167:5
336   |
337LL |     Foo::default() as Foo.bar;
338   |     ^^^^^^^^^^^^^^^^^^^^^
339   |
340help: try surrounding the expression in parentheses
341   |
342LL |     (Foo::default() as Foo).bar;
343   |     ^                     ^
344
345error: casts cannot be followed by a field access
346  --> $DIR/issue-35813-postfix-after-cast.rs:169:5
347   |
348LL |     Foo::default(): Foo.bar;
349   |     ^^^^^^^^^^^^^^^^^^^
350   |
351help: try surrounding the expression in parentheses
352   |
353LL |     (Foo::default(): Foo).bar;
354   |     ^                   ^
355
356error: casts cannot be followed by a method call
357  --> $DIR/issue-35813-postfix-after-cast.rs:84:9
358   |
359LL |         if true { 33 } else { 44 } as i32.max(0),
360   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
361   |
362help: try surrounding the expression in parentheses
363   |
364LL |         (if true { 33 } else { 44 } as i32).max(0),
365   |         ^                                 ^
366
367error: casts cannot be followed by a method call
368  --> $DIR/issue-35813-postfix-after-cast.rs:86:9
369   |
370LL |         if true { 33 } else { 44 }: i32.max(0)
371   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
372   |
373help: try surrounding the expression in parentheses
374   |
375LL |         (if true { 33 } else { 44 }: i32).max(0)
376   |         ^                               ^
377
378error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
379  --> $DIR/issue-35813-postfix-after-cast.rs:131:13
380   |
381LL |     drop as F();
382   |             ^^^ only `Fn` traits may use parentheses
383
384error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
385  --> $DIR/issue-35813-postfix-after-cast.rs:133:15
386   |
387LL |     drop_ptr: F();
388   |               ^^^ only `Fn` traits may use parentheses
389
390error: aborting due to 36 previous errors
391
392For more information about this error, try `rustc --explain E0214`.