feat(diagnostics): add handler for base expression in struct pattern#22206
feat(diagnostics): add handler for base expression in struct pattern#22206ada4a wants to merge 2 commits intorust-lang:masterfrom
Conversation
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { |
There was a problem hiding this comment.
Oh, it turns out I've been running the wrong tests while working on this... But I'm actually not sure what to do with these extraneous errors:
- I can't really ignore syntax errors completely, since the error I'm testing is a syntax error itself
- I guess I could give in and add annotations for them to the test?
It also looks like no other handlers are for syntax errors, so nowhere to draw inspiration from..
There was a problem hiding this comment.
I think that if we already emit syntax errors here, we don't need another error.
There was a problem hiding this comment.
fwiw the error from rustc is not quite ideal (imo):
error: expected `}`, found `g`
--> src/lib.rs:4:36
|
4 | if let Foo { bar: 0, baz: 0, ..g } = f {}
| --- ^ expected `}`
| |
| while parsing the fields for this patternbut I don't have a strong opinion on this.
In this case, I'd open a V2 PR which updates the fixme comment to say something like "we wanted to emit a diagnostic on this but decided to rely on rustc instead, since this is a syntax error"
|
☔ The latest upstream changes (possibly #22197) made this pull request unmergeable. Please resolve the merge conflicts. |
For #22140