Commit af15884
committed
ide-diagnostics: emit error for duplicate field in record pattern
Resolves a FIXME at hir-ty/src/infer/pat.rs that allowed
record patterns like `let S { foo, foo } = ...;` to type-check
with no error. Pushes the InferenceDiagnostic::DuplicateField
variant (added in #22235) at the pattern
site; the cooked diagnostic already supports ExprOrPatId, so no
plumbing changes are needed.
Tests: struct pattern positive, enum variant pattern positive.
Part of #22140.
Signed-off-by: Onyeka Obi <softwareengineerasaservant@isurvivable.cv>1 parent 73ca1d4 commit af15884
2 files changed
Lines changed: 43 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1185 | 1185 | | |
1186 | 1186 | | |
1187 | 1187 | | |
1188 | | - | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
1189 | 1192 | | |
1190 | 1193 | | |
1191 | 1194 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
81 | 120 | | |
82 | 121 | | |
83 | 122 | | |
| |||
0 commit comments