[−][src]Module rustc_ap_syntax::ast
The Rust abstract syntax tree module.
This module contains common structures forming the language AST.
Two main entities in the module are Item
(which represents an AST element with
additional metadata), and ItemKind
(which represents a concrete type and contains
information specific to the type of the item).
Other module items that worth mentioning:
Ty
andTyKind
: A parsed Rust type.Expr
andExprKind
: A parsed Rust expression.Pat
andPatKind
: A parsed Rust pattern. Patterns are often dual to expressions.Stmt
andStmtKind
: An executable action that does not return a value.FnDecl
,FnHeader
andParam
: Metadata associated with a function declaration.Generics
,GenericParam
,WhereClause
: Metadata associated with generic parameters.EnumDef
andVariant
: Enum declaration.Lit
andLitKind
: Literal expressions.MacroDef
,MacStmtStyle
,Mac
, [MacDelimeter
]: Macro definition and invocation.Attribute
: Metadata associated with item.UnOp
, [UnOpKind
],BinOp
,BinOpKind
: Unary and binary operators.
Re-exports
pub use GenericArgs::*; |
pub use UnsafeSource::*; |
pub use crate::util::parser::ExprPrecedence; |
Structs
AngleBracketedArgs | A path like |
AnonConst | A constant (expression) that's not an item or associated item,
but needs its own |
Arm | An arm of a 'match'. |
AssocTyConstraint | A constraint on an associated type (e.g., |
AttrId | |
AttrItem | |
Attribute | Metadata associated with an item. |
BareFnTy | |
Block | A block ( |
Crate | |
EnumDef | |
Expr | An expression. |
Field | Access of a named (e.g., |
FieldPat | A single field in a struct pattern |
FnDecl | A signature (not the body) of a function declaration. |
FnHeader | A function header. |
FnSig | Represents a function's signature in a trait declaration, trait implementation, or free function. |
ForeignItem | |
ForeignMod | Foreign module declaration. |
GenericParam | |
Generics | Represents lifetime, type and const parameters attached to a declaration of a function, enum, trait, etc. |
GlobalAsm | Global inline assembly. |
Ident | |
ImplItem | Represents anything within an |
InlineAsm | Inline assembly. |
InlineAsmOutput | Inline assembly. |
Item | An item. |
Label | A "Label" is an identifier of some point in sources, e.g. in the following code: |
Lifetime | A "Lifetime" is an annotation of the scope in which variable
can be used, e.g. |
Lit | An AST literal. |
Local | Local represents a |
Mac | Represents a macro invocation. The |
MacroDef | Represents a macro definition. |
MetaItem | A spanned compile-time attribute item. |
Mod | Module declaration. |
MutTy | |
Name | An interned string. |
NodeId | |
Param | A parameter in a function header. |
ParenthesizedArgs | A path like |
Pat | |
Path | A "Path" is essentially Rust's notion of a name. |
PathSegment | A segment of a path: an identifier, an optional lifetime, and a set of types. |
PolyTraitRef | |
QSelf | The explicit |
Stmt | A statement |
StrLit | Same as |
StructField | Field of a struct. |
TraitItem | Represents an item declaration within a trait declaration, possibly including a default implementation. A trait item is either required (meaning it doesn't have an implementation, just a signature) or provided (meaning it has a default implementation). |
TraitRef |
|
Ty | |
UseTree | A tree of paths sharing common prefixes.
Used in |
Variant | Enum variant. |
WhereBoundPredicate | A type bound. |
WhereClause | A where-clause in a definition. |
WhereEqPredicate | An equality predicate (unsupported). |
WhereRegionPredicate | A lifetime predicate. |
Enums
AsmDialect | Inline assembly dialect. |
AssocTyConstraintKind | The kinds of an |
AttrKind | |
AttrStyle | Distinguishes between |
BinOpKind | |
BindingMode | |
BlockCheckMode | |
CaptureBy | A capture clause used in closures and |
Constness | |
CrateSugar | |
Defaultness | Item defaultness. For details see the RFC #2532. |
ExprKind | |
Extern |
|
FloatTy | |
ForeignItemKind | An item within an |
FunctionRetTy | |
GenericArg | Concrete argument in the sequence of generic args. |
GenericArgs | The arguments of a path segment. |
GenericBound | The AST represents all type param bounds as types.
|
GenericParamKind | |
ImplItemKind | Represents various kinds of content within an |
ImplPolarity | |
IntTy | |
IsAsync | |
IsAuto | Is the trait definition an auto trait? |
ItemKind | |
LitFloatType | Type of the float literal based on provided suffix. |
LitIntType | Type of the integer literal based on provided suffix. |
LitKind | Literal kind. |
MacDelimiter | |
MacStmtStyle | |
MetaItemKind | A compile-time attribute item. |
Movability | The movability of a generator / closure literal:
whether a generator contains self-references, causing it to be |
Mutability | |
NestedMetaItem | Possible values inside of compile-time attribute lists. |
ParamKindOrd | Specifies the enforced ordering for generic parameters. In the future,
if we wanted to relax this order, we could override |
PatKind | |
RangeEnd | |
RangeLimits | Limit types of a range (inclusive or exclusive) |
RangeSyntax | |
SelfKind | Alternative representation for |
StmtKind | |
StrStyle | |
TraitBoundModifier | A modifier on a bound, currently this is only used for |
TraitItemKind | |
TraitObjectSyntax | Syntax used to declare a trait object. |
TyKind | The various kinds of type recognized by the compiler. |
UintTy | |
UnOp | Unary operator. |
UnsafeSource | |
Unsafety | |
UseTreeKind | Part of |
VariantData | Fields and constructor ids of enum variants and structs. |
VisibilityKind | |
WherePredicate | A single predicate in a where-clause. |
Constants
CRATE_NODE_ID |
|
DUMMY_NODE_ID | When parsing and doing expansions, we initially give all AST nodes this AST node value. Then later, in the renumber pass, we renumber them to have small, positive ids. |
Type Definitions
BinOp | |
CrateConfig | The set of |
ExplicitSelf | |
GenericBounds | |
Visibility |