Closed
Description
It'd be nice to smartly hint about missing tuple parentheses in patterns, especially in positions where parentheses nesting is required.
Example of incorrect code:
fn main() {
match Some((1, 2)) {
Some(x, y) => {}
None => {}
}
}
The error:
error[E0023]: this pattern has 2 fields, but the corresponding tuple variant has 1 field
--> src/main.rs:3:9
|
3 | Some(x, y) => {}
| ^^^^^^^^^^ expected 1 field, found 2
This error is confusing, especially since Some
is a "tuple pattern" which is confusable with its tuple field. An error that suggests missing tuple parentheses would be helpful.
This issue has been assigned to @sam09 via this comment.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Suggestions generated by the compiler applied by `cargo fix`Category: An issue proposing an enhancement or a PR with one.Call for participation: Help is requested to fix this issue.Call for participation: Medium difficulty. Experience needed to fix: Intermediate.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Relevant to the compiler team, which will review and decide on the PR/issue.