Type Definition rustc_parse::parser::ReplaceRange [−][src]
Expand description
Indicates a range of tokens that should be replaced by the tokens in the provided vector. This is used in two places during token collection:
-
During the parsing of an AST node that may have a
#[derive]
attribute, we parse a nested AST node that has#[cfg]
or#[cfg_attr]
In this case, we use aReplaceRange
to replace the entire inner AST node withFlatToken::AttrTarget
, allowing us to perform eager cfg-expansion on anAttrAnnotatedTokenStream
-
When we parse an inner attribute while collecting tokens. We remove inner attributes from the token stream entirely, and instead track them through the
attrs
field on the AST node. This allows us to easily manipulate them (for example, removing the first macro inner attribute to invoke a proc-macro). When create aTokenStream
, the inner attributes get inserted into the proper place in the token stream.