-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve diagnostics suggestion for missing
@
in slice id binding to…
… rest pattern add issue 72373 tests fmt test fix suggestion format Replacement, not insertion of suggested string implement review changes refactor to span_suggestion_verbose, improve suggestion message, change id @ pattern space formatting fmt fix diagnostics spacing between ident and @ refactor reference
- Loading branch information
1 parent
acfc558
commit 593d1ee
Showing
3 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
fn foo(c: &[u32], n: u32) -> u32 { | ||
match *c { | ||
[h, ..] if h > n => 0, | ||
[h, ..] if h == n => 1, | ||
[h, ref ts..] => foo(c, n - h) + foo(ts, n), | ||
//~^ ERROR expected one of `,`, `@`, `]`, or `|`, found `..` | ||
[] => 0, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
error: expected one of `,`, `@`, `]`, or `|`, found `..` | ||
--> $DIR/issue-72373.rs:5:19 | ||
| | ||
LL | [h, ref ts..] => foo(c, n - h) + foo(ts, n), | ||
| ^^ expected one of `,`, `@`, `]`, or `|` | ||
| | ||
help: if you meant to bind the contents of the rest of the array pattern into `ts`, use `@` | ||
| | ||
LL | [h, ref ts @ ..] => foo(c, n - h) + foo(ts, n), | ||
| ^ | ||
|
||
error: aborting due to previous error | ||
|