-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Accept ..
in incorrect position to avoid further errors
#51201
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
src/libsyntax/parse/parser.rs
Outdated
/// Parse the fields of a struct-like pattern | ||
#[allow(unused_assignments)] |
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.
This should be avoidable.
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.
Leftover from a false positive in a previous iteration of the code.
}); | ||
ate_comma = self.eat(&token::Comma); |
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.
Usually after rewrites like this accidental mistakes happen and parser suddenly starts silently accept double commas or something like this, but I'd never notice it in a diff like this, so let's hope our test suite is good enough!
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.
I made a cursory test and the behavior when encountering multiple commas hasn't changed, the parser fails and no attempt at recovery is made.
r=me after fixing tidy |
8254f5f
to
2bdbc77
Compare
This comment has been minimized.
This comment has been minimized.
@bors r=petrochenkov |
📌 Commit 78d82df has been approved by |
This comment has been minimized.
This comment has been minimized.
We currently give a specific message when encountering a `..` anywhere other than the end of a pattern. Modify the parser to accept it (while still emitting the error) so that we don't also trigger "missing fields in pattern" errors afterwards.
When using `..` somewhere other than the end, parse the rest of the pattern correctly while still emitting an error. Add suggestions to either remove trailing `,` or moving the `..` to the end.
@bors r=petrochenkov |
📌 Commit d66d35b has been approved by |
Accept `..` in incorrect position to avoid further errors We currently give a specific message when encountering a `..` anywhere other than the end of a pattern. Modify the parser to accept it (while still emitting the error) so that we don't also trigger "missing fields in pattern" errors afterwards. Add suggestions to either remove trailing `,` or moving the `..` to the end. Follow up to rust-lang#49268.
⌛ Testing commit d66d35b with merge eed6924b27375b8a6a2ee6c7454840e9a3a8aeb5... |
💔 Test failed - status-travis |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@bors retry -- network error |
Accept `..` in incorrect position to avoid further errors We currently give a specific message when encountering a `..` anywhere other than the end of a pattern. Modify the parser to accept it (while still emitting the error) so that we don't also trigger "missing fields in pattern" errors afterwards. Add suggestions to either remove trailing `,` or moving the `..` to the end. Follow up to #49268.
☀️ Test successful - status-appveyor, status-travis |
We currently give a specific message when encountering a
..
anywhereother than the end of a pattern. Modify the parser to accept it (while
still emitting the error) so that we don't also trigger "missing fields
in pattern" errors afterwards.
Add suggestions to either remove trailing
,
or moving the..
to theend.
Follow up to #49268.