]> git.lizzy.rs Git - rust.git/commit
rustc: Fix procedural macros generating lifetime tokens
authorAlex Crichton <alex@alexcrichton.com>
Mon, 21 May 2018 16:02:50 +0000 (09:02 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Mon, 21 May 2018 16:35:15 +0000 (09:35 -0700)
commit3b8f791bf60c0e77ec713356e841c836eb6a55fb
tree4922eff2c78843099e65dfa2a0f3f5f5336c7929
parent6e6a4b1957e2407563f3c9005504f95138ffe28f
rustc: Fix procedural macros generating lifetime tokens

This commit fixes an accidental regression from #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 #50942
src/libsyntax/parse/token.rs
src/test/run-pass-fulldeps/proc-macro/auxiliary/gen-lifetime-token.rs [new file with mode: 0644]
src/test/run-pass-fulldeps/proc-macro/gen-lifetime-token.rs [new file with mode: 0644]