Module syntax::ast [−] [src]

Unstable

Reexports

pub use self::AsmDialect::*;
pub use self::AttrStyle::*;
pub use self::BindingMode::*;
pub use self::BinOp_::*;
pub use self::BlockCheckMode::*;
pub use self::CaptureClause::*;
pub use self::Decl_::*;
pub use self::ExplicitSelf_::*;
pub use self::Expr_::*;
pub use self::FloatTy::*;
pub use self::FunctionRetTy::*;
pub use self::ForeignItem_::*;
pub use self::ImplItem_::*;
pub use self::InlinedItem::*;
pub use self::IntTy::*;
pub use self::Item_::*;
pub use self::KleeneOp::*;
pub use self::Lit_::*;
pub use self::LitIntType::*;
pub use self::LocalSource::*;
pub use self::Mac_::*;
pub use self::MacStmtStyle::*;
pub use self::MetaItem_::*;
pub use self::Mutability::*;
pub use self::Pat_::*;
pub use self::PathListItem_::*;
pub use self::PatWildKind::*;
pub use self::PrimTy::*;
pub use self::Sign::*;
pub use self::Stmt_::*;
pub use self::StrStyle::*;
pub use self::StructFieldKind::*;
pub use self::TokenTree::*;
pub use self::TraitItem_::*;
pub use self::Ty_::*;
pub use self::TyParamBound::*;
pub use self::UintTy::*;
pub use self::UnOp::*;
pub use self::UnsafeSource::*;
pub use self::VariantKind::*;
pub use self::ViewPath_::*;
pub use self::Visibility::*;
pub use self::PathParameters::*;

Structs

AngleBracketedParameterData [Unstable]

A path like Foo<'a, T>

Arg [Unstable]

represents an argument in a function header

Arm [Unstable]

represents one arm of a 'match'

AttrId [Unstable]
Attribute_ [Unstable]

Doc-comments are promoted to attributes that have is_sugared_doc = true

BareFnTy [Unstable]
Block [Unstable]
Crate [Unstable]
DefId [Unstable]
Delimited [Unstable]

A delimited sequence of token trees

EnumDef [Unstable]
Expr [Unstable]

An expression

Field [Unstable]
FieldPat [Unstable]

A single field in a struct pattern

FnDecl [Unstable]

Represents the header (not the body) of a function declaration

ForeignItem [Unstable]
ForeignMod [Unstable]
Generics [Unstable]

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

Ident [Unstable]

An identifier contains a Name (index into the interner table) and a SyntaxContext to track renaming and macro expansion per Flatt et al., "Macros That Work Together"

ImplItem [Unstable]
InlineAsm [Unstable]
Item [Unstable]

An item

Lifetime [Unstable]
LifetimeDef [Unstable]

A lifetime definition, eg 'a: 'b+'c+'d

Local [Unstable]

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

MacroDef [Unstable]

A macro definition, in this crate or imported from another.

MethodSig [Unstable]

Represents a method's signature in a trait declaration, or in an implementation.

Mod [Unstable]
MutTy [Unstable]
Name [Unstable]

A name is a part of an identifier, representing a string or gensym. It's the result of interning.

ParenthesizedParameterData [Unstable]

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

Pat [Unstable]
Path [Unstable]

A "Path" is essentially Rust's notion of a name; for instance: std::cmp::PartialEq . It's represented as a sequence of identifiers, along with a bunch of supporting information.

PathSegment [Unstable]

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

PolyTraitRef [Unstable]
QSelf [Unstable]

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.

SequenceRepetition [Unstable]

A sequence of token treesee

StructDef [Unstable]
StructField_ [Unstable]
TraitItem [Unstable]

Represents a method declaration in a trait declaration, possibly including a default implementation A trait method is either required (meaning it doesn't have an implementation, just a signature) or provided (meaning it has a default implementation).

TraitRef [Unstable]

TraitRef's appear in impls.

Ty [Unstable]
TyParam [Unstable]
TypeBinding [Unstable]
TypeField [Unstable]
VariantArg [Unstable]
Variant_ [Unstable]
WhereBoundPredicate [Unstable]

A type bound, eg for<'c> Foo: Send+Clone+'c

WhereClause [Unstable]

A where clause in a definition

WhereEqPredicate [Unstable]

An equality predicate (unsupported), e.g. T=int

WhereRegionPredicate [Unstable]

A lifetime predicate, e.g. 'a: 'b+'c

Enums

AsmDialect [Unstable]
AttrStyle [Unstable]

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.

BinOp_ [Unstable]
BindingMode [Unstable]
BlockCheckMode [Unstable]
CaptureClause [Unstable]
Decl_ [Unstable]
ExplicitSelf_ [Unstable]

Represents the kind of 'self' associated with a method

Expr_ [Unstable]
FloatTy [Unstable]
ForeignItem_ [Unstable]

An item within an extern block

FunctionRetTy [Unstable]
ImplItem_ [Unstable]
ImplPolarity [Unstable]
InlinedItem [Unstable]

The data we save and restore about an inlined item or method. This is not part of the AST that we parse from a file, but it becomes part of the tree that we trans.

IntTy [Unstable]
Item_ [Unstable]
KleeneOp [Unstable]

A Kleene-style repetition operator for token sequences.

LitIntType [Unstable]
Lit_ [Unstable]
LocalSource [Unstable]

Where a local declaration came from: either a true let ... = ...;, or one desugared from the pattern of a for loop.

MacStmtStyle [Unstable]
Mac_ [Unstable]

Represents a macro invocation. The Path indicates which macro is being invoked, and the vector of token-trees contains the source of the macro invocation.

MatchSource [Unstable]
MetaItem_ [Unstable]
Mutability [Unstable]
PatWildKind [Unstable]
Pat_ [Unstable]
PathListItem_ [Unstable]
PathParameters [Unstable]
PrimTy [Unstable]

Not represented directly in the AST, referred to by name through a ty_path.

Sign [Unstable]
Stmt_ [Unstable]
StrStyle [Unstable]
StructFieldKind [Unstable]
TokenTree [Unstable]

When the main rust parser encounters a syntax-extension invocation, it parses the arguments to the invocation as a token-tree. This is a very loose structure, such that all sorts of different AST-fragments can be passed to syntax extensions using a uniform type.

TraitBoundModifier [Unstable]

A modifier on a bound, currently this is only used for ?Sized, where the modifier is Maybe. Negative bounds should also be handled here.

TraitItem_ [Unstable]
TyParamBound [Unstable]

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.

Ty_ [Unstable]

The different kinds of types recognized by the compiler

UintTy [Unstable]
UnOp [Unstable]
UnsafeSource [Unstable]
Unsafety [Unstable]
VariantKind [Unstable]
ViewPath_ [Unstable]
Visibility [Unstable]
WherePredicate [Unstable]

A single predicate in a where clause

Constants

CRATE_NODE_ID [Unstable]
DUMMY_NODE_ID [Unstable]

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.

EMPTY_CTXT [Unstable]
ILLEGAL_CTXT [Unstable]
LOCAL_CRATE [Unstable]

Item definitions in the currently-compiled crate would have the CrateNum LOCAL_CRATE in their DefId.

Traits

IntSign [Unstable]

Type Definitions

Attribute [Unstable]

Meta-data associated with an item

BinOp [Unstable]
CrateConfig [Unstable]

The set of MetaItems that define the compilation environment of the crate, used to drive conditional compilation

CrateNum [Unstable]
Decl [Unstable]
ExplicitSelf [Unstable]
FnIdent [Unstable]

Function name (not all functions have names)

Lit [Unstable]

A literal

Mac [Unstable]
MetaItem [Unstable]
Mrk [Unstable]

A mark represents a unique id associated with a macro expansion

NodeId [Unstable]
PathListItem [Unstable]
SpannedIdent [Unstable]
Stmt [Unstable]

A statement

StructField [Unstable]
SyntaxContext [Unstable]

A SyntaxContext represents a chain of macro-expandings and renamings. Each macro expansion corresponds to a fresh u32

TyParamBounds [Unstable]
Variant [Unstable]
ViewPath [Unstable]