about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorAaron Hill <aa1ronham@gmail.com>2021-03-26 23:23:20 -0400
committerAaron Hill <aa1ronham@gmail.com>2021-03-26 23:32:18 -0400
commitf94360fd83b49554b6c26999a0030e9cfe800f32 (patch)
tree1a0a71c244967964d54ad691e63b1bfb8c24f374 /compiler/rustc_codegen_llvm/src
parentf811f14006fa46030f1af714f7d640580d3ad822 (diff)
downloadrust-f94360fd83b49554b6c26999a0030e9cfe800f32.tar.gz
rust-f94360fd83b49554b6c26999a0030e9cfe800f32.zip
Always preserve `None`-delimited groups in a captured `TokenStream`
Previously, we would silently remove any `None`-delimiters when
capturing a `TokenStream`, 'flattenting' them to their inner tokens.
This was not normally visible, since we usually have
`TokenKind::Interpolated` (which gets converted to a `None`-delimited
group during macro invocation) instead of an actual `None`-delimited
group.

However, there are a couple of cases where this becomes visible to
proc-macros:
1. A cross-crate `macro_rules!` macro has a `None`-delimited group
   stored in its body (as a result of being produced by another
   `macro_rules!` macro). The cross-crate `macro_rules!` invocation
   can then expand to an attribute macro invocation, which needs
   to be able to see the `None`-delimited group.
2. A proc-macro can invoke an attribute proc-macro with its re-collected
   input. If there are any nonterminals present in the input, they will
   get re-collected to `None`-delimited groups, which will then get
   captured as part of the attribute macro invocation.

Both of these cases are incredibly obscure, so there hopefully won't be
any breakage. This change will allow more agressive 'flattenting' of
nonterminals in #82608 without losing `None`-delimited groups.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions