Module syntax::astUnstable [-] [+] [src]

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::Method_::*;
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

A path like Foo<'a, T>

Arg

represents an argument in a function header

Arm

represents one arm of a 'match'

AssociatedType
AttrId
Attribute_

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

BareFnTy
Block
Crate
DefId
Delimited

A delimited sequence of token trees

EnumDef
Expr
Field
FieldPat
FnDecl

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

ForeignItem
ForeignMod
Generics

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

Ident

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"

InlineAsm
Item
Lifetime
LifetimeDef
Local

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

MacroDef

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

Method
Mod
MutTy
Name

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

ParenthesizedParameterData

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

Pat
Path

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

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

PolyTraitRef
QPath

A "qualified path":

SequenceRepetition

A sequence of token treesee

StructDef
StructField_
TraitRef

TraitRef's appear in impls. resolve maps each TraitRef's ref_id to its defining trait; that's all that the ref_id is for. The impl_id maps to the "self type" of this impl. If this impl is an ItemImpl, the impl_id is redundant (it could be the same as the impl's node id).

Ty
TyParam
TypeBinding
TypeField
TypeMethod

Represents a required method in a trait declaration, one without a default implementation

Typedef
VariantArg
Variant_
WhereBoundPredicate
WhereClause
WhereEqPredicate
WhereRegionPredicate

Enums

AsmDialect
AttrStyle

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_
BindingMode
BlockCheckMode
CaptureClause
Decl_
ExplicitSelf_

Represents the kind of 'self' associated with a method

Expr_
FloatTy
ForeignItem_
FunctionRetTy
ImplItem
ImplPolarity
InlinedItem

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
Item_
KleeneOp

A Kleene-style repetition operator for token sequences.

LitIntType
Lit_
LocalSource

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

MacStmtStyle
Mac_

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. There's only one flavor, now, so this could presumably be simplified.

MatchSource
MetaItem_
Method_
Mutability
PatWildKind
Pat_
PathListItem_
PathParameters
PrimTy

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

Sign
Stmt_
StrStyle
StructFieldKind
TokenTree

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

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

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).

TyParamBound

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_

The different kinds of types recognized by the compiler

UintTy
UnOp
UnsafeSource
Unsafety
VariantKind
ViewPath_
Visibility
WherePredicate

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.

EMPTY_CTXT
ILLEGAL_CTXT
LOCAL_CRATE

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

Type Definitions

Attribute

Meta-data associated with an item

BinOp
CrateConfig

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

CrateNum
Decl
ExplicitSelf
FnIdent

Function name (not all functions have names)

Lit
Mac
MetaItem
Mrk

A mark represents a unique id associated with a macro expansion

NodeId
PathListItem
SpannedIdent
Stmt
StructField
SyntaxContext

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

TyParamBounds
Variant
ViewPath