fork/rust

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

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

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