rust/tests/ui/pattern
Esteban Küber 5c3e01a340 On resolve error of [rest..], suggest [rest @ ..]
When writing a pattern to collect multiple entries of a slice in a
single binding, it is easy to misremember or typo the appropriate syntax
to do so, instead writing the experimental `X..` pattern syntax. When we
encounter a resolve error because `X` isn't available, we suggest
`X @ ..` as an alternative.

```
error[E0425]: cannot find value `rest` in this scope
  --> $DIR/range-pattern-meant-to-be-slice-rest-pattern.rs:3:13
   |
LL |         [1, rest..] => println!("{rest:?}"),
   |             ^^^^ not found in this scope
   |
help: if you meant to collect the rest of the slice in `rest`, use the at operator
   |
LL |         [1, rest @ ..] => println!("{rest:?}"),
   |                  +
```

Fix #88404.
2023-11-17 00:55:55 +00:00
..
auxiliary
bindings-after-at Add a note to duplicate diagnostics 2023-10-05 01:04:41 +00:00
move-ref-patterns
usefulness Auto merge of #116930 - RalfJung:raw-ptr-match, r=davidtwco 2023-11-08 20:42:32 +00:00
byte-string-inference.rs
for-loop-bad-item.rs
for-loop-bad-item.stderr
ignore-all-the-things.rs
incorrect-placement-of-pattern-modifiers.fixed Account for ref and mut in the wrong place for pattern ident renaming 2023-10-30 00:15:49 +00:00
incorrect-placement-of-pattern-modifiers.rs Account for ref and mut in the wrong place for pattern ident renaming 2023-10-30 00:15:49 +00:00
incorrect-placement-of-pattern-modifiers.stderr Account for ref and mut in the wrong place for pattern ident renaming 2023-10-30 00:15:49 +00:00
integer-range-binding.rs
issue-6449.rs
issue-8351-1.rs
issue-8351-2.rs
issue-10392.rs
issue-11577.rs
issue-12582.rs
issue-14221.rs
issue-14221.stderr
issue-15080.rs
issue-17718-patterns.rs
issue-17718-patterns.stderr
issue-22546.rs
issue-27320.rs
issue-52240.rs
issue-52240.stderr
issue-66270-pat-struct-parser-recovery.rs
issue-66270-pat-struct-parser-recovery.stderr
issue-67037-pat-tup-scrut-ty-diff-less-fields.rs
issue-67037-pat-tup-scrut-ty-diff-less-fields.stderr
issue-67776-match-same-name-enum-variant-refs.rs
issue-67776-match-same-name-enum-variant-refs.stderr
issue-68393-let-pat-assoc-constant.rs
issue-68393-let-pat-assoc-constant.stderr
issue-72565.rs Avoid emitting the non_exhaustive error if other errors already occurred 2023-10-11 12:49:57 +00:00
issue-72565.stderr Avoid emitting the non_exhaustive error if other errors already occurred 2023-10-11 12:49:57 +00:00
issue-72574-1.rs
issue-72574-1.stderr
issue-72574-2.rs
issue-72574-2.stderr
issue-74539.rs
issue-74539.stderr
issue-74702.rs
issue-74702.stderr
issue-74954.rs
issue-80186-mut-binding-help-suggestion.rs
issue-80186-mut-binding-help-suggestion.stderr
issue-88074-pat-range-type-inference-err.rs
issue-88074-pat-range-type-inference-err.stderr
issue-88074-pat-range-type-inference.rs
issue-92074-macro-ice.rs
issue-92074-macro-ice.stderr
issue-94866.rs
issue-94866.stderr Tweak spans for "adt defined here" note 2023-11-03 18:26:16 +01:00
issue-95878.rs
issue-95878.stderr
issue-106552.rs
issue-106552.stderr
issue-106862.fixed
issue-106862.rs
issue-106862.stderr
issue-110508.rs add regression test 2023-07-01 02:28:15 -04:00
issue-114896.rs fixes #114896 2023-09-07 11:07:33 +08:00
issue-114896.stderr fixes #114896 2023-09-07 11:07:33 +08:00
issue-115599.rs use PatKind::error when an ADT const value has violation 2023-10-15 19:20:06 +08:00
issue-115599.stderr use PatKind::error when an ADT const value has violation 2023-10-15 19:20:06 +08:00
non-constant-in-const-path.rs
non-constant-in-const-path.stderr
non-structural-match-types.mir.stderr Fix inline const pattern unsafety checking in THIR 2023-10-16 15:57:59 +00:00
non-structural-match-types.rs Fix inline const pattern unsafety checking in THIR 2023-10-16 15:57:59 +00:00
non-structural-match-types.thir.stderr Fix inline const pattern unsafety checking in THIR 2023-10-16 15:57:59 +00:00
pat-shadow-in-nested-binding.rs
pat-shadow-in-nested-binding.stderr
pat-struct-field-expr-has-type.rs
pat-struct-field-expr-has-type.stderr
pat-tuple-bad-type.rs
pat-tuple-bad-type.stderr
pat-tuple-field-count-cross.rs
pat-tuple-field-count-cross.stderr
pat-tuple-overfield.rs
pat-tuple-overfield.stderr
pat-tuple-underfield.rs
pat-tuple-underfield.stderr
pat-type-err-formal-param.rs
pat-type-err-formal-param.stderr
pat-type-err-let-stmt.rs
pat-type-err-let-stmt.stderr
patkind-litrange-no-expr.rs
patkind-litrange-no-expr.stderr Add a note to duplicate diagnostics 2023-10-05 01:04:41 +00:00
pattern-binding-disambiguation.rs
pattern-binding-disambiguation.stderr
pattern-error-continue.rs
pattern-error-continue.stderr
pattern-ident-path-generics.rs
pattern-ident-path-generics.stderr
pattern-tyvar-2.rs
pattern-tyvar-2.stderr
pattern-tyvar.rs
pattern-tyvar.stderr
range-pattern-meant-to-be-slice-rest-pattern.rs On resolve error of [rest..], suggest [rest @ ..] 2023-11-17 00:55:55 +00:00
range-pattern-meant-to-be-slice-rest-pattern.stderr On resolve error of [rest..], suggest [rest @ ..] 2023-11-17 00:55:55 +00:00
rest-pat-semantic-disallowed.rs
rest-pat-semantic-disallowed.stderr
rest-pat-syntactic.rs
rest-pat-syntactic.stderr
size-and-align.rs
slice-array-infer.rs add more tests 2023-07-17 22:06:32 +00:00
slice-pattern-refutable.rs address review 2023-07-17 22:06:32 +00:00
slice-pattern-refutable.stderr address review 2023-07-17 22:06:32 +00:00
slice-patterns-ambiguity.rs add tests for refutable patterns 2023-07-17 22:02:09 +00:00
slice-patterns-ambiguity.stderr add tests for refutable patterns 2023-07-17 22:02:09 +00:00
slice-patterns-irrefutable.rs address review 2023-07-28 11:20:11 +00:00
slice-patterns-irrefutable.stderr Reorder fullfillment errors to keep more interesting ones first 2023-10-04 02:04:14 +00:00
slice-patterns-nested.rs add test for nested pattern 2023-07-17 22:06:32 +00:00
suggest-adding-appropriate-missing-pattern-excluding-comments.fixed
suggest-adding-appropriate-missing-pattern-excluding-comments.rs
suggest-adding-appropriate-missing-pattern-excluding-comments.stderr