@@ -133,8 +133,90 @@ error: expected one of `:`, `;`, `=`, `@`, or `|`, found `.`
133133LL | { let x.-0; }
134134 | ^ expected one of `:`, `;`, `=`, `@`, or `|`
135135
136+ error: expected one of `:`, `;`, `=`, `@`, or `|`, found `.`
137+ --> $DIR/recover-pat-exprs.rs:16:12
138+ |
139+ LL | { let x.0u32; }
140+ | ^ expected one of `:`, `;`, `=`, `@`, or `|`
141+
142+ error: expected one of `:`, `;`, `=`, `@`, or `|`, found `.`
143+ --> $DIR/recover-pat-exprs.rs:17:12
144+ |
145+ LL | { let x.0.0_f64; }
146+ | ^ expected one of `:`, `;`, `=`, `@`, or `|`
147+
148+ error: expected a pattern, found an expression
149+ --> $DIR/recover-pat-exprs.rs:23:9
150+ |
151+ LL | x[0] => (),
152+ | ^^^^ arbitrary expressions are not allowed in patterns
153+ |
154+ help: check the value in an arm guard
155+ |
156+ LL | val if val == x[0] => (),
157+ | ~~~ ++++++++++++++
158+ help: extract the expression into a `const` and refer to it
159+ |
160+ LL + const VAL: _ = x[0];
161+ LL ~ match 0 {
162+ LL ~ VAL => (),
163+ |
164+ help: wrap the expression in a inline const (requires `#![feature(inline_const_pat)]`)
165+ |
166+ LL | const { x[0] } => (),
167+ | +++++++ +
168+
136169error: expected a pattern, found an expression
137- --> $DIR/recover-pat-exprs.rs:20:9
170+ --> $DIR/recover-pat-exprs.rs:24:9
171+ |
172+ LL | x[..] => (),
173+ | ^^^^^ arbitrary expressions are not allowed in patterns
174+ |
175+ help: check the value in an arm guard
176+ |
177+ LL | val if val == x[..] => (),
178+ | ~~~ +++++++++++++++
179+ help: extract the expression into a `const` and refer to it
180+ |
181+ LL + const VAL: _ = x[..];
182+ LL ~ match 0 {
183+ LL | x[0] => (),
184+ LL ~ VAL => (),
185+ |
186+ help: wrap the expression in a inline const (requires `#![feature(inline_const_pat)]`)
187+ |
188+ LL | const { x[..] } => (),
189+ | +++++++ +
190+
191+ error: expected one of `:`, `;`, `=`, `@`, or `|`, found `[`
192+ --> $DIR/recover-pat-exprs.rs:27:12
193+ |
194+ LL | { let x[0, 1, 2]; }
195+ | ^ expected one of `:`, `;`, `=`, `@`, or `|`
196+
197+ error: expected one of `:`, `;`, `=`, `@`, or `|`, found `[`
198+ --> $DIR/recover-pat-exprs.rs:28:12
199+ |
200+ LL | { let x[0; 20]; }
201+ | ^ expected one of `:`, `;`, `=`, `@`, or `|`
202+
203+ error: expected one of `:`, `;`, `=`, `@`, or `|`, found `[`
204+ --> $DIR/recover-pat-exprs.rs:29:12
205+ |
206+ LL | { let x[]; }
207+ | ^ expected one of `:`, `;`, `=`, `@`, or `|`
208+
209+ error: expected one of `)`, `,`, `@`, or `|`, found `[`
210+ --> $DIR/recover-pat-exprs.rs:30:13
211+ |
212+ LL | { let (x[]); }
213+ | ^
214+ | |
215+ | expected one of `)`, `,`, `@`, or `|`
216+ | help: missing `,`
217+
218+ error: expected a pattern, found an expression
219+ --> $DIR/recover-pat-exprs.rs:37:9
138220 |
139221LL | x.f() => (),
140222 | ^^^^^ arbitrary expressions are not allowed in patterns
@@ -155,7 +237,7 @@ LL | const { x.f() } => (),
155237 | +++++++ +
156238
157239error: expected a pattern, found an expression
158- --> $DIR/recover-pat-exprs.rs:21 :9
240+ --> $DIR/recover-pat-exprs.rs:38 :9
159241 |
160242LL | x._f() => (),
161243 | ^^^^^^ arbitrary expressions are not allowed in patterns
@@ -177,7 +259,7 @@ LL | const { x._f() } => (),
177259 | +++++++ +
178260
179261error: expected a pattern, found an expression
180- --> $DIR/recover-pat-exprs.rs:22 :9
262+ --> $DIR/recover-pat-exprs.rs:39 :9
181263 |
182264LL | x? => (),
183265 | ^^ arbitrary expressions are not allowed in patterns
@@ -200,7 +282,7 @@ LL | const { x? } => (),
200282 | +++++++ +
201283
202284error: expected a pattern, found an expression
203- --> $DIR/recover-pat-exprs.rs:23 :9
285+ --> $DIR/recover-pat-exprs.rs:40 :9
204286 |
205287LL | ().f() => (),
206288 | ^^^^^^ arbitrary expressions are not allowed in patterns
@@ -224,7 +306,7 @@ LL | const { ().f() } => (),
224306 | +++++++ +
225307
226308error: expected a pattern, found an expression
227- --> $DIR/recover-pat-exprs.rs:24 :9
309+ --> $DIR/recover-pat-exprs.rs:41 :9
228310 |
229311LL | (0, x)?.f() => (),
230312 | ^^^^^^^^^^^ arbitrary expressions are not allowed in patterns
@@ -248,7 +330,7 @@ LL | const { (0, x)?.f() } => (),
248330 | +++++++ +
249331
250332error: expected a pattern, found an expression
251- --> $DIR/recover-pat-exprs.rs:25 :9
333+ --> $DIR/recover-pat-exprs.rs:42 :9
252334 |
253335LL | x.f().g() => (),
254336 | ^^^^^^^^^ arbitrary expressions are not allowed in patterns
@@ -272,7 +354,7 @@ LL | const { x.f().g() } => (),
272354 | +++++++ +
273355
274356error: expected a pattern, found an expression
275- --> $DIR/recover-pat-exprs.rs:26 :9
357+ --> $DIR/recover-pat-exprs.rs:43 :9
276358 |
277359LL | 0.f()?.g()?? => (),
278360 | ^^^^^^^^^^^^ arbitrary expressions are not allowed in patterns
@@ -296,7 +378,7 @@ LL | const { 0.f()?.g()?? } => (),
296378 | +++++++ +
297379
298380error: expected a pattern, found an expression
299- --> $DIR/recover-pat-exprs.rs:33 :9
381+ --> $DIR/recover-pat-exprs.rs:50 :9
300382 |
301383LL | x as usize => (),
302384 | ^^^^^^^^^^ arbitrary expressions are not allowed in patterns
@@ -317,7 +399,7 @@ LL | const { x as usize } => (),
317399 | +++++++ +
318400
319401error: expected a pattern, found an expression
320- --> $DIR/recover-pat-exprs.rs:34 :9
402+ --> $DIR/recover-pat-exprs.rs:51 :9
321403 |
322404LL | 0 as usize => (),
323405 | ^^^^^^^^^^ arbitrary expressions are not allowed in patterns
@@ -339,7 +421,7 @@ LL | const { 0 as usize } => (),
339421 | +++++++ +
340422
341423error: expected a pattern, found an expression
342- --> $DIR/recover-pat-exprs.rs:35 :9
424+ --> $DIR/recover-pat-exprs.rs:52 :9
343425 |
344426LL | x.f().0.4 as f32 => (),
345427 | ^^^^^^^^^^^^^^^^ arbitrary expressions are not allowed in patterns
@@ -362,7 +444,7 @@ LL | const { x.f().0.4 as f32 } => (),
362444 | +++++++ +
363445
364446error: expected a pattern, found an expression
365- --> $DIR/recover-pat-exprs.rs:42 :9
447+ --> $DIR/recover-pat-exprs.rs:59 :9
366448 |
367449LL | 1 + 1 => (),
368450 | ^^^^^ arbitrary expressions are not allowed in patterns
@@ -383,7 +465,7 @@ LL | const { 1 + 1 } => (),
383465 | +++++++ +
384466
385467error: expected a pattern, found an expression
386- --> $DIR/recover-pat-exprs.rs:43 :9
468+ --> $DIR/recover-pat-exprs.rs:60 :9
387469 |
388470LL | (1 + 2) * 3 => (),
389471 | ^^^^^^^^^^^ arbitrary expressions are not allowed in patterns
@@ -405,7 +487,7 @@ LL | const { (1 + 2) * 3 } => (),
405487 | +++++++ +
406488
407489error: left-hand side of `@` must be a binding
408- --> $DIR/recover-pat-exprs.rs:56 :9
490+ --> $DIR/recover-pat-exprs.rs:73 :9
409491 |
410492LL | x.sqrt() @ .. => (),
411493 | --------^^^--
@@ -416,13 +498,13 @@ LL | x.sqrt() @ .. => (),
416498 = note: bindings are `x`, `mut x`, `ref x`, and `ref mut x`
417499
418500error: expected one of `)`, `,`, or `|`, found `+`
419- --> $DIR/recover-pat-exprs.rs:70 :12
501+ --> $DIR/recover-pat-exprs.rs:87 :12
420502 |
421503LL | (_ + 1) => (),
422504 | ^ expected one of `)`, `,`, or `|`
423505
424506error: expected a pattern, found an expression
425- --> $DIR/recover-pat-exprs.rs:54 :9
507+ --> $DIR/recover-pat-exprs.rs:71 :9
426508 |
427509LL | u8::MAX.abs() => (),
428510 | ^^^^^^^^^^^^^ arbitrary expressions are not allowed in patterns
@@ -443,7 +525,7 @@ LL | const { u8::MAX.abs() } => (),
443525 | +++++++ +
444526
445527error: expected a pattern, found an expression
446- --> $DIR/recover-pat-exprs.rs:59 :17
528+ --> $DIR/recover-pat-exprs.rs:76 :17
447529 |
448530LL | z @ w @ v.u() => (),
449531 | ^^^^^ arbitrary expressions are not allowed in patterns
@@ -467,7 +549,7 @@ LL | z @ w @ const { v.u() } => (),
467549 | +++++++ +
468550
469551error: expected a pattern, found an expression
470- --> $DIR/recover-pat-exprs.rs:61 :9
552+ --> $DIR/recover-pat-exprs.rs:78 :9
471553 |
472554LL | y.ilog(3) => (),
473555 | ^^^^^^^^^ arbitrary expressions are not allowed in patterns
@@ -491,7 +573,7 @@ LL | const { y.ilog(3) } => (),
491573 | +++++++ +
492574
493575error: expected a pattern, found an expression
494- --> $DIR/recover-pat-exprs.rs:63 :9
576+ --> $DIR/recover-pat-exprs.rs:80 :9
495577 |
496578LL | n + 1 => (),
497579 | ^^^^^ arbitrary expressions are not allowed in patterns
@@ -515,7 +597,7 @@ LL | const { n + 1 } => (),
515597 | +++++++ +
516598
517599error: expected a pattern, found an expression
518- --> $DIR/recover-pat-exprs.rs:65 :10
600+ --> $DIR/recover-pat-exprs.rs:82 :10
519601 |
520602LL | ("".f() + 14 * 8) => (),
521603 | ^^^^^^^^^^^^^^^ arbitrary expressions are not allowed in patterns
@@ -539,7 +621,7 @@ LL | (const { "".f() + 14 * 8 }) => (),
539621 | +++++++ +
540622
541623error: expected a pattern, found an expression
542- --> $DIR/recover-pat-exprs.rs:68 :9
624+ --> $DIR/recover-pat-exprs.rs:85 :9
543625 |
544626LL | f?() => (),
545627 | ^^^^ arbitrary expressions are not allowed in patterns
@@ -563,7 +645,7 @@ LL | const { f?() } => (),
563645 | +++++++ +
564646
565647error: expected a pattern, found an expression
566- --> $DIR/recover-pat-exprs.rs:74 :9
648+ --> $DIR/recover-pat-exprs.rs:91 :9
567649 |
568650LL | let 1 + 1 = 2;
569651 | ^^^^^ arbitrary expressions are not allowed in patterns
@@ -575,7 +657,7 @@ LL + 1 + 1 = 2;
575657 |
576658
577659error: expected one of `)`, `,`, `@`, or `|`, found `*`
578- --> $DIR/recover-pat-exprs.rs:77 :28
660+ --> $DIR/recover-pat-exprs.rs:94 :28
579661 |
580662LL | let b = matches!(x, (x * x | x.f()) | x[0]);
581663 | ^ expected one of `)`, `,`, `@`, or `|`
@@ -584,16 +666,16 @@ LL | let b = matches!(x, (x * x | x.f()) | x[0]);
584666 = note: while parsing argument for this `pat` macro fragment
585667
586668error: expected a pattern, found an expression
587- --> $DIR/recover-pat-exprs.rs:48 :5
669+ --> $DIR/recover-pat-exprs.rs:65 :5
588670 |
589671LL | 1 + 2 * PI.cos() => 2,
590672 | ^^^^^^^^^^^^^^^^ arbitrary expressions are not allowed in patterns
591673
592674error: expected a pattern, found an expression
593- --> $DIR/recover-pat-exprs.rs:56 :9
675+ --> $DIR/recover-pat-exprs.rs:73 :9
594676 |
595677LL | x.sqrt() @ .. => (),
596678 | ^^^^^^^^ arbitrary expressions are not allowed in patterns
597679
598- error: aborting due to 32 previous errors
680+ error: aborting due to 40 previous errors
599681
0 commit comments