rust/tests/ui/parser/recover/recover-pat-exprs.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

810 lines
26 KiB
Plaintext

error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:5:9
|
LL | x.y => (),
| ^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider moving the expression to a match arm guard
|
LL | val if val == x.y => (),
| ~~~ +++++++++++++
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = x.y;
LL ~ match 0 {
LL | x => (),
LL ~ VAL => (),
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | const { x.y } => (),
| +++++++ +
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:6:9
|
LL | x.0 => (),
| ^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider moving the expression to a match arm guard
|
LL | val if val == x.0 => (),
| ~~~ +++++++++++++
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = x.0;
LL ~ match 0 {
LL | x => (),
LL | x.y => (),
LL ~ VAL => (),
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | const { x.0 } => (),
| +++++++ +
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:7:9
|
LL | x._0 => (),
| ^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider moving the expression to a match arm guard
|
LL | val if val == x._0 => (),
| ~~~ ++++++++++++++
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = x._0;
LL ~ match 0 {
LL | x => (),
LL | x.y => (),
LL | x.0 => (),
LL ~ VAL => (),
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | const { x._0 } => (),
| +++++++ +
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:8:9
|
LL | x.0.1 => (),
| ^^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider moving the expression to a match arm guard
|
LL | val if val == x.0.1 => (),
| ~~~ +++++++++++++++
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = x.0.1;
LL ~ match 0 {
LL | x => (),
...
LL | x._0 => (),
LL ~ VAL => (),
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | const { x.0.1 } => (),
| +++++++ +
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:9:9
|
LL | x.4.y.17.__z => (),
| ^^^^^^^^^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider moving the expression to a match arm guard
|
LL | val if val == x.4.y.17.__z => (),
| ~~~ ++++++++++++++++++++++
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = x.4.y.17.__z;
LL ~ match 0 {
LL | x => (),
...
LL | x.0.1 => (),
LL ~ VAL => (),
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | const { x.4.y.17.__z } => (),
| +++++++ +
error: expected one of `:`, `;`, `=`, `@`, or `|`, found `.`
--> $DIR/recover-pat-exprs.rs:12:12
|
LL | { let x.0e0; }
| ^ expected one of `:`, `;`, `=`, `@`, or `|`
error: expected one of `:`, `;`, `=`, `@`, or `|`, found `.`
--> $DIR/recover-pat-exprs.rs:13:12
|
LL | { let x.-0.0; }
| ^ expected one of `:`, `;`, `=`, `@`, or `|`
error: expected one of `:`, `;`, `=`, `@`, or `|`, found `.`
--> $DIR/recover-pat-exprs.rs:14:12
|
LL | { let x.-0; }
| ^ expected one of `:`, `;`, `=`, `@`, or `|`
error: expected one of `:`, `;`, `=`, `@`, or `|`, found `.`
--> $DIR/recover-pat-exprs.rs:16:12
|
LL | { let x.0u32; }
| ^ expected one of `:`, `;`, `=`, `@`, or `|`
error: expected one of `:`, `;`, `=`, `@`, or `|`, found `.`
--> $DIR/recover-pat-exprs.rs:17:12
|
LL | { let x.0.0_f64; }
| ^ expected one of `:`, `;`, `=`, `@`, or `|`
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:23:9
|
LL | x[0] => (),
| ^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider moving the expression to a match arm guard
|
LL | val if val == x[0] => (),
| ~~~ ++++++++++++++
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = x[0];
LL ~ match 0 {
LL ~ VAL => (),
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | const { x[0] } => (),
| +++++++ +
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:24:9
|
LL | x[..] => (),
| ^^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider moving the expression to a match arm guard
|
LL | val if val == x[..] => (),
| ~~~ +++++++++++++++
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = x[..];
LL ~ match 0 {
LL | x[0] => (),
LL ~ VAL => (),
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | const { x[..] } => (),
| +++++++ +
error: expected one of `:`, `;`, `=`, `@`, or `|`, found `[`
--> $DIR/recover-pat-exprs.rs:27:12
|
LL | { let x[0, 1, 2]; }
| ^ expected one of `:`, `;`, `=`, `@`, or `|`
error: expected one of `:`, `;`, `=`, `@`, or `|`, found `[`
--> $DIR/recover-pat-exprs.rs:28:12
|
LL | { let x[0; 20]; }
| ^ expected one of `:`, `;`, `=`, `@`, or `|`
error: expected one of `:`, `;`, `=`, `@`, or `|`, found `[`
--> $DIR/recover-pat-exprs.rs:29:12
|
LL | { let x[]; }
| ^ expected one of `:`, `;`, `=`, `@`, or `|`
error: expected one of `)`, `,`, `@`, or `|`, found `[`
--> $DIR/recover-pat-exprs.rs:30:13
|
LL | { let (x[]); }
| ^
| |
| expected one of `)`, `,`, `@`, or `|`
| help: missing `,`
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:37:9
|
LL | x.f() => (),
| ^^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider moving the expression to a match arm guard
|
LL | val if val == x.f() => (),
| ~~~ +++++++++++++++
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = x.f();
LL ~ match 0 {
LL ~ VAL => (),
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | const { x.f() } => (),
| +++++++ +
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:38:9
|
LL | x._f() => (),
| ^^^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider moving the expression to a match arm guard
|
LL | val if val == x._f() => (),
| ~~~ ++++++++++++++++
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = x._f();
LL ~ match 0 {
LL | x.f() => (),
LL ~ VAL => (),
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | const { x._f() } => (),
| +++++++ +
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:39:9
|
LL | x? => (),
| ^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider moving the expression to a match arm guard
|
LL | val if val == x? => (),
| ~~~ ++++++++++++
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = x?;
LL ~ match 0 {
LL | x.f() => (),
LL | x._f() => (),
LL ~ VAL => (),
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | const { x? } => (),
| +++++++ +
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:40:9
|
LL | ().f() => (),
| ^^^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider moving the expression to a match arm guard
|
LL | val if val == ().f() => (),
| ~~~ ++++++++++++++++
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = ().f();
LL ~ match 0 {
LL | x.f() => (),
LL | x._f() => (),
LL | x? => (),
LL ~ VAL => (),
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | const { ().f() } => (),
| +++++++ +
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:41:9
|
LL | (0, x)?.f() => (),
| ^^^^^^^^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider moving the expression to a match arm guard
|
LL | val if val == (0, x)?.f() => (),
| ~~~ +++++++++++++++++++++
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = (0, x)?.f();
LL ~ match 0 {
LL | x.f() => (),
...
LL | ().f() => (),
LL ~ VAL => (),
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | const { (0, x)?.f() } => (),
| +++++++ +
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:42:9
|
LL | x.f().g() => (),
| ^^^^^^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider moving the expression to a match arm guard
|
LL | val if val == x.f().g() => (),
| ~~~ +++++++++++++++++++
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = x.f().g();
LL ~ match 0 {
LL | x.f() => (),
...
LL | (0, x)?.f() => (),
LL ~ VAL => (),
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | const { x.f().g() } => (),
| +++++++ +
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:43:9
|
LL | 0.f()?.g()?? => (),
| ^^^^^^^^^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider moving the expression to a match arm guard
|
LL | val if val == 0.f()?.g()?? => (),
| ~~~ ++++++++++++++++++++++
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = 0.f()?.g()??;
LL ~ match 0 {
LL | x.f() => (),
...
LL | x.f().g() => (),
LL ~ VAL => (),
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | const { 0.f()?.g()?? } => (),
| +++++++ +
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:50:9
|
LL | x as usize => (),
| ^^^^^^^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider moving the expression to a match arm guard
|
LL | val if val == x as usize => (),
| ~~~ ++++++++++++++++++++
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = x as usize;
LL ~ match 0 {
LL ~ VAL => (),
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | const { x as usize } => (),
| +++++++ +
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:51:9
|
LL | 0 as usize => (),
| ^^^^^^^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider moving the expression to a match arm guard
|
LL | val if val == 0 as usize => (),
| ~~~ ++++++++++++++++++++
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = 0 as usize;
LL ~ match 0 {
LL | x as usize => (),
LL ~ VAL => (),
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | const { 0 as usize } => (),
| +++++++ +
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:52:9
|
LL | x.f().0.4 as f32 => (),
| ^^^^^^^^^^^^^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider moving the expression to a match arm guard
|
LL | val if val == x.f().0.4 as f32 => (),
| ~~~ ++++++++++++++++++++++++++
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = x.f().0.4 as f32;
LL ~ match 0 {
LL | x as usize => (),
LL | 0 as usize => (),
LL ~ VAL => (),
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | const { x.f().0.4 as f32 } => (),
| +++++++ +
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:59:9
|
LL | 1 + 1 => (),
| ^^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider moving the expression to a match arm guard
|
LL | val if val == 1 + 1 => (),
| ~~~ +++++++++++++++
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = 1 + 1;
LL ~ match 0 {
LL ~ VAL => (),
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | const { 1 + 1 } => (),
| +++++++ +
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:60:9
|
LL | (1 + 2) * 3 => (),
| ^^^^^^^^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider moving the expression to a match arm guard
|
LL | val if val == (1 + 2) * 3 => (),
| ~~~ +++++++++++++++++++++
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = (1 + 2) * 3;
LL ~ match 0 {
LL | 1 + 1 => (),
LL ~ VAL => (),
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | const { (1 + 2) * 3 } => (),
| +++++++ +
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:63:9
|
LL | x.0 > 2 => (),
| ^^^^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider moving the expression to a match arm guard
|
LL | val if val == (x.0 > 2) => (),
| ~~~ +++++++++++++++++++
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = x.0 > 2;
LL ~ match 0 {
LL | 1 + 1 => (),
...
LL |
LL ~ VAL => (),
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | const { x.0 > 2 } => (),
| +++++++ +
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:64:9
|
LL | x.0 == 2 => (),
| ^^^^^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider moving the expression to a match arm guard
|
LL | val if val == (x.0 == 2) => (),
| ~~~ ++++++++++++++++++++
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = x.0 == 2;
LL ~ match 0 {
LL | 1 + 1 => (),
...
LL | x.0 > 2 => (),
LL ~ VAL => (),
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | const { x.0 == 2 } => (),
| +++++++ +
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:69:13
|
LL | (x, y.0 > 2) if x != 0 => (),
| ^^^^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider moving the expression to the match arm guard
|
LL | (x, val) if x != 0 && val == (y.0 > 2) => (),
| ~~~ +++++++++++++++++++
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = y.0 > 2;
LL ~ match (0, 0) {
LL ~ (x, VAL) if x != 0 => (),
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | (x, const { y.0 > 2 }) if x != 0 => (),
| +++++++ +
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:70:13
|
LL | (x, y.0 > 2) if x != 0 || x != 1 => (),
| ^^^^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider moving the expression to the match arm guard
|
LL | (x, val) if (x != 0 || x != 1) && val == (y.0 > 2) => (),
| ~~~ + +++++++++++++++++++++
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = y.0 > 2;
LL ~ match (0, 0) {
LL | (x, y.0 > 2) if x != 0 => (),
LL ~ (x, VAL) if x != 0 || x != 1 => (),
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | (x, const { y.0 > 2 }) if x != 0 || x != 1 => (),
| +++++++ +
error: left-hand side of `@` must be a binding
--> $DIR/recover-pat-exprs.rs:83:9
|
LL | x.sqrt() @ .. => (),
| --------^^^--
| | |
| | also a pattern
| interpreted as a pattern, not a binding
|
= note: bindings are `x`, `mut x`, `ref x`, and `ref mut x`
error: expected one of `)`, `,`, or `|`, found `+`
--> $DIR/recover-pat-exprs.rs:97:12
|
LL | (_ + 1) => (),
| ^ expected one of `)`, `,`, or `|`
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:81:9
|
LL | u8::MAX.abs() => (),
| ^^^^^^^^^^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider moving the expression to a match arm guard
|
LL | val if val == u8::MAX.abs() => (),
| ~~~ +++++++++++++++++++++++
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = u8::MAX.abs();
LL ~ match u8::MAX {
LL ~ VAL => (),
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | const { u8::MAX.abs() } => (),
| +++++++ +
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:86:17
|
LL | z @ w @ v.u() => (),
| ^^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider moving the expression to a match arm guard
|
LL | z @ w @ val if val == v.u() => (),
| ~~~ +++++++++++++++
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = v.u();
LL ~ match u8::MAX {
LL | u8::MAX.abs() => (),
...
LL |
LL ~ z @ w @ VAL => (),
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | z @ w @ const { v.u() } => (),
| +++++++ +
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:88:9
|
LL | y.ilog(3) => (),
| ^^^^^^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider moving the expression to a match arm guard
|
LL | val if val == y.ilog(3) => (),
| ~~~ +++++++++++++++++++
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = y.ilog(3);
LL ~ match u8::MAX {
LL | u8::MAX.abs() => (),
...
LL |
LL ~ VAL => (),
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | const { y.ilog(3) } => (),
| +++++++ +
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:90:9
|
LL | n + 1 => (),
| ^^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider moving the expression to a match arm guard
|
LL | val if val == n + 1 => (),
| ~~~ +++++++++++++++
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = n + 1;
LL ~ match u8::MAX {
LL | u8::MAX.abs() => (),
...
LL |
LL ~ VAL => (),
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | const { n + 1 } => (),
| +++++++ +
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:92:10
|
LL | ("".f() + 14 * 8) => (),
| ^^^^^^^^^^^^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider moving the expression to a match arm guard
|
LL | (val) if val == "".f() + 14 * 8 => (),
| ~~~ +++++++++++++++++++++++++
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = "".f() + 14 * 8;
LL ~ match u8::MAX {
LL | u8::MAX.abs() => (),
...
LL |
LL ~ (VAL) => (),
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | (const { "".f() + 14 * 8 }) => (),
| +++++++ +
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:95:9
|
LL | f?() => (),
| ^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
help: consider moving the expression to a match arm guard
|
LL | val if val == f?() => (),
| ~~~ ++++++++++++++
help: consider extracting the expression into a `const`
|
LL + const VAL: /* Type */ = f?();
LL ~ match u8::MAX {
LL | u8::MAX.abs() => (),
...
LL | 0 | ((1) | 2) | 3 => (),
LL ~ VAL => (),
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
LL | const { f?() } => (),
| +++++++ +
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:101:9
|
LL | let 1 + 1 = 2;
| ^^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
error: expected one of `)`, `,`, `@`, or `|`, found `*`
--> $DIR/recover-pat-exprs.rs:104:28
|
LL | let b = matches!(x, (x * x | x.f()) | x[0]);
| ^ expected one of `)`, `,`, `@`, or `|`
--> $SRC_DIR/core/src/macros/mod.rs:LL:COL
|
= note: while parsing argument for this `pat` macro fragment
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:60:10
|
LL | (1 + 2) * 3 => (),
| ^^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:75:5
|
LL | 1 + 2 * PI.cos() => 2,
| ^^^^^^^^^^^^^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
error: expected a pattern, found an expression
--> $DIR/recover-pat-exprs.rs:83:9
|
LL | x.sqrt() @ .. => (),
| ^^^^^^^^ not a pattern
|
= note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
error: aborting due to 45 previous errors