type ParserReplacement = (ParserRange, Option<AttrsTarget>);
Expand description
Indicates a range of tokens that should be replaced by an AttrsTarget
(replacement) or be replaced by nothing (deletion). This is used in two
places during token collection.
-
Replacement. During the parsing of an AST node that may have a
#[derive]
attribute, when we parse a nested AST node that has#[cfg]
or#[cfg_attr]
, we replace the entire inner AST node withFlatToken::AttrsTarget
. This lets us perform eager cfg-expansion on anAttrTokenStream
. -
Deletion. We delete inner attributes from all collected token streams, and instead track them through the
attrs
field on the AST node. This lets us manipulate them similarly to outer attributes. When we create aTokenStream
, the inner attributes are inserted into the proper place in the token stream.
Each replacement starts off in ParserReplacement
form but is converted to
NodeReplacement
form when it is attached to a single AST node, via
LazyAttrTokenStreamImpl
.
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 24 bytes