Module rustc::hir [] [src]

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Reexports

pub use self::BinOp_::*;
pub use self::BlockCheckMode::*;
pub use self::CaptureClause::*;
pub use self::Decl_::*;
pub use self::Expr_::*;
pub use self::FunctionRetTy::*;
pub use self::ForeignItem_::*;
pub use self::Item_::*;
pub use self::Mutability::*;
pub use self::PrimTy::*;
pub use self::Stmt_::*;
pub use self::Ty_::*;
pub use self::TyParamBound::*;
pub use self::UnOp::*;
pub use self::UnsafeSource::*;
pub use self::Visibility::Public;
pub use self::Visibility::Inherited;

Modules

check_attr [
Experimental
]

This module implements some validity checks for attributes. In particular it verifies that #[inline] and #[repr] attributes are attached to items that actually support them and if there are conflicts between multiple such attributes attached to the same item.

def [
Experimental
]
def_id [
Experimental
]
intravisit [
Experimental
]

HIR walker for walking the contents of nodes.

itemlikevisit [
Experimental
]
lowering [
Experimental
]

Lowers the AST to the HIR.

map [
Experimental
]
pat_util [
Experimental
]
print [
Experimental
]
svh [
Experimental
]

Calculation and management of a Strict Version Hash for crates

Structs

Arg [
Experimental
]

represents an argument in a function header

Arm [
Experimental
]

represents one arm of a 'match'

BareFnTy [
Experimental
]
Block [
Experimental
]
Body [
Experimental
]

The body of a function, closure, or constant value. In the case of a function, the body contains not only the function body itself (which is an expression), but also the argument patterns, since those are something that the caller doesn't really care about.

BodyId [
Experimental
]
Crate [
Experimental
]

The top-level data structure that stores the entire contents of the crate currently being compiled.

Destination [
Experimental
]
EnumDef [
Experimental
]
Expr [
Experimental
]

An expression

Field [
Experimental
]
FieldPat [
Experimental
]

A single field in a struct pattern

FnDecl [
Experimental
]

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

ForeignItem [
Experimental
]
ForeignMod [
Experimental
]
Freevar [
Experimental
]

A free variable referred to in a function.

Generics [
Experimental
]

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

GlobalAsm [
Experimental
]
HirId [
Experimental
]

A HirId uniquely identifies a node in the HIR of the current crate. It is composed of the owner, which is the DefIndex of the directly enclosing hir::Item, hir::TraitItem, or hir::ImplItem (i.e. the closest "item-like"), and the local_id which is unique within the given owner.

ImplItem [
Experimental
]

Represents anything within an impl block

ImplItemId [
Experimental
]
ImplItemRef [
Experimental
]

A reference from an impl to one of its associated items. This contains the item's id, naturally, but also the item's name and some other high-level details (like whether it is an associated type or method, and whether it is public). This allows other passes to find the impl they want without loading the id (which means fewer edges in the incremental compilation graph).

InlineAsm [
Experimental
]
InlineAsmOutput [
Experimental
]
Item [
Experimental
]

An item

ItemId [
Experimental
]
ItemLocalId [
Experimental
]

An ItemLocalId uniquely identifies something within a given "item-like", that is within a hir::Item, hir::TraitItem, or hir::ImplItem. There is no guarantee that the numerical value of a given ItemLocalId corresponds to the node's position within the owning item in any way, but there is a guarantee that the LocalItemIds within an owner occupy a dense range of integers starting at zero, so a mapping that maps all or most nodes within an "item-like" to something else can be implement by a Vec instead of a tree or hash map.

Lifetime [
Experimental
]
LifetimeDef [
Experimental
]

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

Local [
Experimental
]

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

MacroDef [
Experimental
]

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

MethodSig [
Experimental
]

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

Mod [
Experimental
]
MutTy [
Experimental
]
Pat [
Experimental
]
Path [
Experimental
]

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.

PathParameters [
Experimental
]
PathSegment [
Experimental
]

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

PolyTraitRef [
Experimental
]
StructField [
Experimental
]
TraitCandidate [
Experimental
]
TraitItem [
Experimental
]

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

TraitItemId [
Experimental
]
TraitItemRef [
Experimental
]

A reference from an trait to one of its associated items. This contains the item's id, naturally, but also the item's name and some other high-level details (like whether it is an associated type or method, and whether it is public). This allows other passes to find the impl they want without loading the id (which means fewer edges in the incremental compilation graph).

TraitRef [
Experimental
]

TraitRef's appear in impls.

Ty [
Experimental
]
TyParam [
Experimental
]
TypeBinding [
Experimental
]
Variant_ [
Experimental
]
WhereBoundPredicate [
Experimental
]

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

WhereClause [
Experimental
]

A where clause in a definition

WhereEqPredicate [
Experimental
]

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

WhereRegionPredicate [
Experimental
]

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

Enums

AssociatedItemKind [
Experimental
]
BinOp_ [
Experimental
]
BindingAnnotation [
Experimental
]

Explicit binding annotations given in the HIR for a binding. Note that this is not the final binding mode that we infer after type inference.

BlockCheckMode [
Experimental
]
CaptureClause [
Experimental
]
Constness [
Experimental
]
Decl_ [
Experimental
]
Defaultness [
Experimental
]
Expr_ [
Experimental
]
ForeignItem_ [
Experimental
]

An item within an extern block

FunctionRetTy [
Experimental
]
ImplItemKind [
Experimental
]

Represents different contents within impls

ImplPolarity [
Experimental
]
Item_ [
Experimental
]
LifetimeName [
Experimental
]
LocalSource [
Experimental
]

Hints at the original code for a let statement

LoopIdError [
Experimental
]
LoopIdResult [
Experimental
]
LoopSource [
Experimental
]

The loop type that yielded an ExprLoop

MatchSource [
Experimental
]

Hints at the original code for a match _ { .. }

Mutability [
Experimental
]
PatKind [
Experimental
]
PrimTy [
Experimental
]

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

QPath [
Experimental
]

Optionally Self-qualified value/type path or associated extension.

RangeEnd [
Experimental
]
ScopeTarget [
Experimental
]
Stmt_ [
Experimental
]
SyntheticTyParamKind [
Experimental
]

Synthetic Type Parameters are converted to an other form during lowering, this allows to track the original form they had. Usefull for error messages.

TraitBoundModifier [
Experimental
]

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

TraitItemKind [
Experimental
]

Represents a trait method or associated constant or type

TraitMethod [
Experimental
]

A trait method's body (or just argument names).

TyParamBound [
Experimental
]

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_ [
Experimental
]

The different kinds of types recognized by the compiler

UnOp [
Experimental
]
UnsafeGeneric [
Experimental
]
UnsafeSource [
Experimental
]
Unsafety [
Experimental
]
UseKind [
Experimental
]
VariantData [
Experimental
]

Fields and Ids of enum variants and structs

Visibility [
Experimental
]
WherePredicate [
Experimental
]

A single predicate in a where clause

Constants

CRATE_HIR_ID [
Experimental
]

The HirId corresponding to CRATE_NODE_ID and CRATE_DEF_INDEX

DUMMY_HIR_ID [
Experimental
]
DUMMY_ITEM_LOCAL_ID [
Experimental
]

Type Definitions

BinOp [
Experimental
]
CaptureModeMap [
Experimental
]
CrateConfig [
Experimental
]
Decl [
Experimental
]
FreevarMap [
Experimental
]
GlobMap [
Experimental
]
HirVec [
Experimental
]

HIR doesn't commit to a concrete storage type and has its own alias for a vector. It can be Vec, P<[T]> or potentially Box<[T]>, or some other container with similar behavior. Unlike AST, HIR is mostly a static structure, so we can use an owned slice instead of Vec to avoid keeping extra capacity.

Stmt [
Experimental
]

A statement

TraitMap [
Experimental
]
TyParamBounds [
Experimental
]
Variant [
Experimental
]