-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not complain about unmentioned fields in recovered patterns #59198
Conversation
When the parser has to recover from malformed code in a pattern, do not complain about missing fields.
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
r? @zackmdavis |
r? @davidtwco |
@@ -4698,7 +4698,7 @@ impl<'a> Parser<'a> { | |||
let (fields, etc) = self.parse_pat_fields().unwrap_or_else(|mut e| { | |||
e.emit(); | |||
self.recover_stmt(); | |||
(vec![], false) | |||
(vec![], true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing my understanding: this is getting assigned to the name etc
; so, the mechanism here is that we're pretending that struct patterns that failed to parse have a ..
so that we shouldn't emit additional errors about missing fields?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct.
Looks like I need to keep better track of my review queue. 😰 r? @zackmdavis @bors r+ |
📌 Commit 6cd6759 has been approved by |
…davis Do not complain about unmentioned fields in recovered patterns When the parser has to recover from malformed code in a pattern, do not complain about missing fields. Fix rust-lang#59145.
Rollup of 12 pull requests Successful merges: - #57987 (Fix some AArch64 typos) - #58581 (Refactor generic parameter encoder functions) - #58803 (fs::copy() unix: set file mode early) - #58848 (Prevent cache issues on version updates) - #59198 (Do not complain about unmentioned fields in recovered patterns) - #59351 (Include llvm-ar with llvm-tools component) - #59413 (HirIdify hir::ItemId) - #59441 (Remove the block on natvis for lld-link.) - #59448 (Use consistent phrasing for all macro summaries) - #59456 (Add documentation about `for` used as higher ranked trait bounds) - #59472 (Document that `std::io::BufReader` discards contents on drop) - #59474 (Fix link capitalization in documentation of std::io::BufWriter.) Failed merges: r? @ghost
When the parser has to recover from malformed code in a pattern, do not
complain about missing fields.
Fix #59145.