-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Parser: fix ICE on failure to parse token tree #33726
Conversation
A "token tree" is how the contents of a macro_rules! definition is parsed, before expanding it. This is a very permissive form of parsing. Fixes rust-lang#33569.
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @pnkfelix (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
} | ||
_ => { | ||
// Bad token: an error will already have been emitted; just skip it. | ||
self.bump(); |
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.
Is there a reason we need to bump()
here?
(i'm just waiting for the suggested edit to be made...) |
I took a brief look at your suggestion, @jseyfried, but I don't yet understand rustc well enough to be in a good position to agree with it (without spending more time staring at it). I'm happy to spend some more time looking at this at some point, but I won't have any time at least in the next week. So if you (or someone else) wants to go ahead and create a separate PR then that's fine with me, I'll then close this one. |
Cool, closing this one then. At least my typo fixes will make it in =) |
Fix a compiler panic when the "token tree" parser encounters something unexpected.
A "token tree" is how the contents of a
macro_rules!
definition are parsed, before expanding it. This is a very permissive form of parsing.Fixes #33569, fixes #33728.
Also fix some typos in comments.
Note: I'm very much a newb at Rust compiler hackery. Someone experienced definitely needs to sanity-check this :)