Skip to content

Conversation

@c4rlo
Copy link
Contributor

@c4rlo c4rlo commented May 18, 2016

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 :)

c4rlo added 2 commits May 18, 2016 22:38
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.
@rust-highfive
Copy link
Contributor

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();
Copy link
Contributor

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?

@pnkfelix
Copy link
Contributor

(i'm just waiting for the suggested edit to be made...)

@c4rlo
Copy link
Contributor Author

c4rlo commented May 25, 2016

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.

@jseyfried
Copy link
Contributor

@c4rlo

So if you (or someone else) wants to go ahead and create a separate PR then that's fine with me

Done, see #33870. Thanks for starting this!

@c4rlo
Copy link
Contributor Author

c4rlo commented May 25, 2016

Cool, closing this one then. At least my typo fixes will make it in =)

@c4rlo c4rlo closed this May 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Macro utilizing patterns results in an ICE ICE: Macro parser: Error message, then compiler panic.

4 participants