rust/tests/ui/parser/recover/recover-pat-wildcards.stderr
Esteban Küber 7f5548fa8b On function and method calls in patterns, link to the book
```
error: expected a pattern, found an expression
 --> f889.rs:3:13
  |
3 |     let (x, y.drop()) = (1, 2); //~ ERROR
  |             ^^^^^^^^ not a pattern
  |
  = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>

error[E0532]: expected a pattern, found a function call
 --> f889.rs:2:13
  |
2 |     let (x, drop(y)) = (1, 2); //~ ERROR
  |             ^^^^ not a tuple struct or tuple variant
  |
  = note: function calls are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
```

Fix #97200.
2024-10-06 01:44:59 +00:00

95 lines
2.7 KiB
Plaintext

error: expected one of `=>`, `if`, or `|`, found `+`
--> $DIR/recover-pat-wildcards.rs:5:11
|
LL | _ + 1 => ()
| ^ expected one of `=>`, `if`, or `|`
error: expected one of `)`, `,`, or `|`, found `%`
--> $DIR/recover-pat-wildcards.rs:11:12
|
LL | (_ % 4) => ()
| ^ expected one of `)`, `,`, or `|`
error: expected one of `=>`, `if`, or `|`, found `.`
--> $DIR/recover-pat-wildcards.rs:17:10
|
LL | _.x() => ()
| ^ expected one of `=>`, `if`, or `|`
error: expected one of `=>`, `if`, or `|`, found `..=`
--> $DIR/recover-pat-wildcards.rs:23:10
|
LL | _..=4 => ()
| ^^^ expected one of `=>`, `if`, or `|`
error: expected one of `=>`, `if`, or `|`, found reserved identifier `_`
--> $DIR/recover-pat-wildcards.rs:29:11
|
LL | .._ => ()
| ^ expected one of `=>`, `if`, or `|`
error[E0586]: inclusive range with no end
--> $DIR/recover-pat-wildcards.rs:35:10
|
LL | 0..._ => ()
| ^^^
|
= note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`)
help: use `..` instead
|
LL - 0..._ => ()
LL + 0.._ => ()
|
error: expected one of `=>`, `if`, or `|`, found reserved identifier `_`
--> $DIR/recover-pat-wildcards.rs:35:13
|
LL | 0..._ => ()
| ^ expected one of `=>`, `if`, or `|`
error: expected one of `)`, `,`, or `|`, found `*`
--> $DIR/recover-pat-wildcards.rs:43:12
|
LL | (_ * 0)..5 => ()
| ^ expected one of `)`, `,`, or `|`
error: expected one of `=>`, `if`, or `|`, found `(`
--> $DIR/recover-pat-wildcards.rs:49:11
|
LL | ..(_) => ()
| ^ expected one of `=>`, `if`, or `|`
error: range pattern bounds cannot have parentheses
--> $DIR/recover-pat-wildcards.rs:55:13
|
LL | 4..=(2 + _) => ()
| ^ ^
|
help: remove these parentheses
|
LL - 4..=(2 + _) => ()
LL + 4..=2 + _ => ()
|
error: expected a pattern range bound, found an expression
--> $DIR/recover-pat-wildcards.rs:55:14
|
LL | 4..=(2 + _) => ()
| ^^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = 2 + _;
LL ~ match 9 {
LL ~ 4..=(VAL) => ()
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | 4..=(const { 2 + _ }) => ()
| +++++++ +
error: aborting due to 11 previous errors
For more information about this error, try `rustc --explain E0586`.