error: expected a pattern, found an expression --> $DIR/recover-pat-issues.rs:6:13 | LL | Foo("hi".to_owned()) => true, | ^^^^^^^^^^^^^^^ arbitrary expressions are not allowed in patterns | help: consider moving the expression to a match arm guard | LL | Foo(val) if val == "hi".to_owned() => true, | ~~~ +++++++++++++++++++++++++ help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = "hi".to_owned(); LL ~ match foo { LL ~ Foo(VAL) => true, | help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`) | LL | Foo(const { "hi".to_owned() }) => true, | +++++++ + error: expected a pattern, found an expression --> $DIR/recover-pat-issues.rs:14:20 | LL | Bar { baz: "hi".to_owned() } => true, | ^^^^^^^^^^^^^^^ arbitrary expressions are not allowed in patterns | help: consider moving the expression to a match arm guard | LL | Bar { baz } if baz == "hi".to_owned() => true, | ~~~ +++++++++++++++++++++++++ help: consider extracting the expression into a `const` | LL + const BAZ: /* Type */ = "hi".to_owned(); LL ~ match bar { LL ~ Bar { baz: BAZ } => true, | help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`) | LL | Bar { baz: const { "hi".to_owned() } } => true, | +++++++ + error: expected a pattern, found an expression --> $DIR/recover-pat-issues.rs:25:11 | LL | &["foo".to_string()] => {} | ^^^^^^^^^^^^^^^^^ arbitrary expressions are not allowed in patterns | help: consider moving the expression to a match arm guard | LL | &[val] if val == "foo".to_string() => {} | ~~~ +++++++++++++++++++++++++++ help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = "foo".to_string(); LL ~ match foo.as_slice() { LL ~ &[VAL] => {} | help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`) | LL | &[const { "foo".to_string() }] => {} | +++++++ + error: expected a pattern, found an expression --> $DIR/recover-pat-issues.rs:36:17 | LL | if let Some(MAGIC.0 as usize) = None:: {} | ^^^^^^^^^^^^^^^^ arbitrary expressions are not allowed in patterns | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = MAGIC.0 as usize; LL ~ if let Some(VAL) = None:: {} | help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`) | LL | if let Some(const { MAGIC.0 as usize }) = None:: {} | +++++++ + error: expected a pattern, found an expression --> $DIR/recover-pat-issues.rs:41:13 | LL | if let (-1.some(4)) = (0, Some(4)) {} | ^^^^^^^^^^ arbitrary expressions are not allowed in patterns | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = -1.some(4); LL ~ if let (VAL) = (0, Some(4)) {} | help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`) | LL | if let (const { -1.some(4) }) = (0, Some(4)) {} | +++++++ + error: expected a pattern, found an expression --> $DIR/recover-pat-issues.rs:44:13 | LL | if let (-1.Some(4)) = (0, Some(4)) {} | ^^^^^^^^^^ arbitrary expressions are not allowed in patterns | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = -1.Some(4); LL ~ if let (VAL) = (0, Some(4)) {} | help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`) | LL | if let (const { -1.Some(4) }) = (0, Some(4)) {} | +++++++ + error: aborting due to 6 previous errors