[][src]Module rustc_ast::ast

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

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:

Re-exports

pub use crate::util::parser::ExprPrecedence;
pub use GenericArgs::*;
pub use UnsafeSource::*;
pub use crate::node_id::NodeId;
pub use crate::node_id::CRATE_NODE_ID;
pub use crate::node_id::DUMMY_NODE_ID;

Structs

AngleBracketedArgsInternal

A path like Foo<'a, T>.

AnonConstInternal

A constant (expression) that's not an item or associated item, but needs its own DefId for type-checking, const-eval, etc. These are usually found nested inside types (e.g., array lengths) or expressions (e.g., repeat counts), and also used to define explicit discriminant values for enum variants.

ArmInternal

An arm of a 'match'.

AssocTyConstraintInternal

A constraint on an associated type (e.g., A = Bar in Foo<A = Bar> or A: TraitA + TraitB in Foo<A: TraitA + TraitB>).

AttrIdInternal
AttrItemInternal
AttributeInternal

Metadata associated with an item.

BareFnTyInternal
BlockInternal

A block ({ .. }).

CrateInternal
EnumDefInternal
ExprInternal

An expression.

FieldInternal

Access of a named (e.g., obj.foo) or unnamed (e.g., obj.0) struct field.

FieldPatInternal

A single field in a struct pattern

FnDeclInternal

A signature (not the body) of a function declaration.

FnHeaderInternal

A function header.

FnSigInternal

Represents a function's signature in a trait declaration, trait implementation, or free function.

ForeignModInternal

Foreign module declaration.

GenericParamInternal
GenericsInternal

Represents lifetime, type and const parameters attached to a declaration of a function, enum, trait, etc.

GlobalAsmInternal

Global inline assembly.

InlineAsmInternal

Inline assembly.

InlineAsmOptionsInternal
ItemInternal

An item definition.

LabelInternal

A "Label" is an identifier of some point in sources, e.g. in the following code:

LifetimeInternal

A "Lifetime" is an annotation of the scope in which variable can be used, e.g. 'a in &'a i32.

LitInternal

An AST literal.

LlvmInlineAsmInternal

LLVM-style inline assembly.

LlvmInlineAsmOutputInternal

LLVM-style inline assembly.

LocalInternal

Local represents a let statement, e.g., let <pat>:<ty> = <expr>;.

MacCallInternal

Represents a macro invocation. The path indicates which macro is being invoked, and the args are arguments passed to it.

MacroDefInternal

Represents a macro definition.

MetaItemInternal

A spanned compile-time attribute item.

ModInternal

Module declaration.

MutTyInternal
ParamInternal

A parameter in a function header.

ParenthesizedArgsInternal

A path like Foo(A, B) -> C.

PatInternal
PathInternal

A "Path" is essentially Rust's notion of a name.

PathSegmentInternal

A segment of a path: an identifier, an optional lifetime, and a set of types.

PolyTraitRefInternal
QSelfInternal

The explicit Self type in a "qualified path". The actual path, including the trait and the associated item, is stored separately. position represents the index of the associated item qualified with this Self type.

StmtInternal

A statement

StrLitInternal

Same as Lit, but restricted to string literals.

StructFieldInternal

Field of a struct.

TraitRefInternal

TraitRefs appear in impls.

TyInternal
UseTreeInternal

A tree of paths sharing common prefixes. Used in use items both at top-level and inside of braces in import groups.

VariantInternal

Enum variant.

WhereBoundPredicateInternal

A type bound.

WhereClauseInternal

A where-clause in a definition.

WhereEqPredicateInternal

An equality predicate (unsupported).

WhereRegionPredicateInternal

A lifetime predicate.

Enums

AngleBracketedArgInternal

Either an argument for a parameter e.g., 'a, Vec<u8>, 0, or a constraint on an associated item, e.g., Item = String or Item: Bound.

AssocItemKindInternal

Represents associated item kinds.

AssocTyConstraintKindInternal

The kinds of an AssocTyConstraint.

AsyncInternal
AttrKindInternal
AttrStyleInternal

Distinguishes between Attributes that decorate items and Attributes that are contained as statements within items. These two cases need to be distinguished for pretty-printing.

BinOpKindInternal
BindingModeInternal
BlockCheckModeInternal
BorrowKindInternal

The kind of borrow in an AddrOf expression, e.g., &place or &raw const place.

CaptureByInternal

A capture clause used in closures and async blocks.

ConstInternal
CrateSugarInternal
DefaultnessInternal

Item defaultness. For details see the RFC #2532.

ExprKindInternal
ExternInternal

extern qualifier on a function item or function type.

FloatTyInternal
FnRetTyInternal
ForeignItemKindInternal

An item in extern block.

GenericArgInternal

Concrete argument in the sequence of generic args.

GenericArgsInternal

The arguments of a path segment.

GenericBoundInternal

The AST represents all type param bounds as types. typeck::collect::compute_bounds matches these against the "special" built-in traits (see middle::lang_items) and detects Copy, Send and Sync.

GenericParamKindInternal
ImplPolarityInternal
InlineAsmOperandInternal

Inline assembly operand.

InlineAsmRegOrRegClassInternal

Inline assembly operand explicit register or register class.

InlineAsmTemplatePieceInternal
IntTyInternal
IsAutoInternal

Is the trait definition an auto trait?

ItemKindInternal
LitFloatTypeInternal

Type of the float literal based on provided suffix.

LitIntTypeInternal

Type of the integer literal based on provided suffix.

LitKindInternal

Literal kind.

LlvmAsmDialectInternal

Inline assembly dialect.

MacArgsInternal

Arguments passed to an attribute or a function-like macro.

MacDelimiterInternal
MacStmtStyleInternal
MetaItemKindInternal

A compile-time attribute item.

MovabilityInternal

The movability of a generator / closure literal: whether a generator contains self-references, causing it to be !Unpin.

MutabilityInternal
NestedMetaItemInternal

Possible values inside of compile-time attribute lists.

ParamKindOrdInternal

Specifies the enforced ordering for generic parameters. In the future, if we wanted to relax this order, we could override PartialEq and PartialOrd, to allow the kinds to be unordered.

PatKindInternal
RangeEndInternal
RangeLimitsInternal

Limit types of a range (inclusive or exclusive)

RangeSyntaxInternal
SelfKindInternal

Alternative representation for Args describing self parameter of methods.

StmtKindInternal
StrStyleInternal
TraitBoundModifierInternal

A modifier on a bound, e.g., ?Sized or ?const Trait.

TraitObjectSyntaxInternal

Syntax used to declare a trait object.

TyKindInternal

The various kinds of type recognized by the compiler.

UintTyInternal
UnOpInternal

Unary operator.

UnsafeInternal
UnsafeSourceInternal
UseTreeKindInternal

Part of use item to the right of its prefix.

VariantDataInternal

Fields and constructor ids of enum variants and structs.

VisibilityKindInternal
WherePredicateInternal

A single predicate in a where-clause.

Type Definitions

AssocItemInternal

Represents associated items. These include items in impl and trait definitions.

AttrVecInternal

A list of attributes.

BinOpInternal
ExplicitSelfInternal
ForeignItemInternal
GenericBoundsInternal
VisibilityInternal