-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Lifetimes in procedural macros aren't being parsed correctly #50942
Comments
Note the missing |
Oh crap, |
Sorry. |
Aha that'd do it! You found it much faster than I did :) And no worries! Would you like to send a PR? Or shall I? |
It'll happen sooner if you do it. |
Ok! I'll take care of this |
This commit fixes an accidental regression from rust-lang#50473 where lifetime tokens produced by procedural macros ended up getting lost in translation in the compiler and not actually producing parseable code. The issue lies in the fact that a lifetime's `Ident` is prefixed with `'`. The `glue` implementation for gluing joint tokens together forgot to take this into account so the lifetime inside of `Ident` was missing the leading tick! The `glue` implementation here is updated to create a new `Symbol` in these situations to manufacture a new `Ident` with a leading tick to ensure it parses correctly. Closes rust-lang#50942
I've posted a fix for this at #50946 |
…petrochenkov rustc: Fix procedural macros generating lifetime tokens This commit fixes an accidental regression from rust-lang#50473 where lifetime tokens produced by procedural macros ended up getting lost in translation in the compiler and not actually producing parseable code. The issue lies in the fact that a lifetime's `Ident` is prefixed with `'`. The `glue` implementation for gluing joint tokens together forgot to take this into account so the lifetime inside of `Ident` was missing the leading tick! The `glue` implementation here is updated to create a new `Symbol` in these situations to manufacture a new `Ident` with a leading tick to ensure it parses correctly. Closes rust-lang#50942
Given this procedural macro:
and this invocation:
we get:
The text was updated successfully, but these errors were encountered: