diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2023-11-17 00:55:55 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2023-11-17 00:55:55 +0000 |
| commit | 5c3e01a340699069e1e8d9303fff0563fdbd09e2 (patch) | |
| tree | ae3cb3518643d4947e89d6e18604dc2bae1eccfb /compiler/rustc_pattern_analysis/src | |
| parent | 1be1e84872185c427de42f4d9e757d3e3e28d90e (diff) | |
| download | rust-5c3e01a340699069e1e8d9303fff0563fdbd09e2.tar.gz rust-5c3e01a340699069e1e8d9303fff0563fdbd09e2.zip | |
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.
Diffstat (limited to 'compiler/rustc_pattern_analysis/src')
0 files changed, 0 insertions, 0 deletions
