Uninformative error message when using wrong ellipsis in pattern matching #47968
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Because I naturally write ellipsises as three dots rather than two, I found myself writing the following:
This is wrong because it should be
Stuff::Holder{..}
: wrong number of dots in the match.But the error message I got is this:
This isn't an intrinsically unreasonable error message or anything, but it totally mislead me: I did not parse "expected identifier, found
...
" as meaning "You have the wrong number of dots and three dots is not valid syntax here", I just figured that I was misunderstanding something and that e.g. you had to mention at least one field or something and the ellipsis syntax was only for then ignoring the other fields.This was I think compounded by the fact that it provided a second error message "pattern does not mention field
thing
" because it meant that I didn't read it as "You have a syntax error" but "You have a syntactically valid pattern match that happens not to be semantically valid due to some requirement you don't understand".Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: