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