about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-07-24 00:50:15 +0000
committerbors <bors@rust-lang.org>2018-07-24 00:50:15 +0000
commite842dea7a3d9babc7a19bd201711f4243840fab0 (patch)
treec7a212212633585aac939c067d60cc76cddf2490 /src/liballoc
parent6a1c0637ce44aeea6c60527f4c0e7fb33f2bcd0d (diff)
parentd760aaf7077d0b4b1e093a3f353c4b84c2c6d394 (diff)
downloadrust-e842dea7a3d9babc7a19bd201711f4243840fab0.tar.gz
rust-e842dea7a3d9babc7a19bd201711f4243840fab0.zip
Auto merge of #52618 - alexcrichton:capture-more, r=petrochenkov
rustc: Implement tokenization of nested items

Ever plagued by #43081 the compiler can return surprising spans in situations
related to procedural macros. This is exhibited by #47983 where whenever a
procedural macro is invoked in a nested item context it would fail to have
correct span information.

While #43230 provided a "hack" to cache the token stream used for each item in
the compiler it's not a full-blown solution. This commit continues to extend
this "hack" a bit more to work for nested items.

Previously in the parser the `parse_item` method would collect the tokens for an
item into a cache on the item itself. It turned out, however, that nested items
were parsed through the `parse_item_` method, so they didn't receive similar
treatment. To remedy this situation the hook for collecting tokens was moved
into `parse_item_` instead of `parse_item`.

Afterwards the token collection scheme was updated to support nested collection
of tokens. This is implemented by tracking `TokenStream` tokens instead of
`TokenTree` to allow for collecting items into streams at intermediate layers
and having them interleaved in the upper layers.

All in all, this...

Closes #47983
Diffstat (limited to 'src/liballoc')
0 files changed, 0 insertions, 0 deletions