rustc_hir

Module hir

Source

Modules§

size_asserts đź”’

Macros§

expect_methods_self đź”’
expect_methods_self_kind đź”’

Structs§

AnonConst
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.
Arm
Represents a single arm of a match expression, e.g. <pat> (if <guard>) => <body>.
AssocItemConstraint
A constraint on an associated item.
AttrItem
AttrPath
Attribute
AttributeMap
Attributes owned by a HIR owner.
BareFnTy
BindingMode
The mode of a binding (mut, ref mut, etc). Used for both the explicit binding annotations given in the HIR for a binding and the final binding mode that we infer after type inference/match ergonomics. .0 is the by-reference mode (ref, ref mut, or by value), .1 is the mutability of the binding.
Block
A block of statements { .. }, which may have a label (in this case the targeted_by_break field will be true) and may be unsafe by means of the rules being anything but DefaultBlock.
Body
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
Closure
ConstArg
A constant that enters the type system, used for arguments to const generics (e.g. array lengths).
ConstBlock
An inline constant expression const { something }.
Crate
The top-level data structure that stores the entire contents of the crate currently being compiled.
Destination
DotDotPos
EnumDef
Expr
An expression.
ExprField
FieldDef
FnDecl
Represents the header (not the body) of a function declaration.
FnHeader
FnSig
Represents a function’s signature in a trait declaration, trait implementation, or a free function.
ForeignItem
ForeignItemId
ForeignItemRef
A reference from a foreign block to one of its 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).
GenericArgs
The generic arguments and associated item constraints of a path segment.
GenericParam
GenericParamCount
Generics
Represents lifetimes and type parameters attached to a declaration of a function, enum, trait, etc.
Impl
Represents an impl block declaration.
ImplItem
Represents an associated item within an impl block.
ImplItemId
ImplItemRef
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).
InferArg
InlineAsm
Item
An item
ItemId
LetExpr
Represents a let <pat>[: <ty>] = <expr> expression (not a LetStmt), occurring in an if-let or let-else, evaluating to a boolean. Typically the pattern is refutable.
LetStmt
Represents a let statement (i.e., let <pat>:<ty> = <init>;).
Lifetime
Mod
ModSpans
MutTy
OpaqueTy
OwnerInfo
Full information resulting from lowering an AST node.
OwnerNodes
Map of all HIR nodes inside the current owner. These nodes are mapped by ItemLocalId alongside the index of their parent node. The HIR tree, including bodies, is pre-hashed.
Param
Represents a parameter in a function header.
ParentedNode
HIR node coupled with its parent’s id in the same HIR owner.
Pat
PatExpr
PatField
A single field in a struct pattern.
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
PreciseCapturingNonLifetimeArg
We need to have a Node for the HirId that we attach the type/const param resolution to. Lifetimes don’t have this problem, and for them, it’s actually kind of detrimental to use a custom node type versus just using Lifetime, since resolve_bound_vars operates on Lifetimes.
Stmt
A statement.
TraitBoundModifiers
The modifiers on a trait bound.
TraitCandidate
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).
TraitItemId
TraitItemRef
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
References to traits in impls.
Ty
UnsafeBinderTy
Upvar
A variable captured by a closure.
Variant
WhereBoundPredicate
A type bound (e.g., for<'c> Foo: Send + Clone + 'c).
WhereEqPredicate
An equality predicate (e.g., T = int); currently unsupported.
WherePredicate
A single predicate in a where-clause.
WhereRegionPredicate
A lifetime predicate (e.g., 'a: 'b + 'c).

Enums§

AssocItemConstraintKind
The kind of associated item constraint.
AssocItemKind
AttrArgs
Arguments passed to an attribute macro.
AttrKind
BinOpKind
BlockCheckMode
BodyOwnerKind
BorrowKind
The kind of borrow in an AddrOf expression, e.g., &place or &raw const place.
BoundConstness
The constness of a trait bound.
BoundPolarity
The polarity of a trait bound.
ByRef
CaptureBy
A capture clause used in closures and async blocks.
ClosureBinder
Represents for<...> binder before a closure
ClosureKind
ConstArgKind
See ConstArg.
ConstContext
The kind of an item that requires const-checking.
Constness
CoroutineDesugaring
CoroutineKind
The type of source expression that caused this coroutine to be created.
CoroutineSource
In the case of a coroutine created as part of an async/gen construct, which kind of async/gen construct caused it to be created?
Defaultness
ExprKind
FnRetTy
ForeignItemKind
An item within an extern block.
GenericArg
GenericArgsParentheses
GenericBound
GenericParamKind
GenericParamSource
Records where the generic parameter originated from.
HeaderSafety
The actualy safety specified in syntax. We may treat its safety different within the type system to create a “sound by default” system that needs checking this enum explicitly to allow unsafe operations.
ImplItemKind
Represents various kinds of content within an impl.
ImplPolarity
ImplicitSelfKind
Represents what type of implicit self a function has, if any.
InferDelegationKind
InlineAsmOperand
IsAsync
IsAuto
Is the trait definition an auto trait?
ItemKind
LifetimeName
LifetimeParamKind
LifetimeSuggestionPosition
LocalSource
Hints at the original code for a let statement.
LoopIdError
LoopSource
The loop type that yielded an ExprKind::Loop.
MatchSource
Hints at the original code for a match _ { .. }.
MaybeOwner
MissingLifetimeKind
Movability
The movability of a coroutine / closure literal: whether a coroutine contains self-references, causing it to be !Unpin.
Mutability
Node
OpaqueTyOrigin
From whence the opaque type came.
OwnerNode
ParamName
PatExprKind
PatKind
PreciseCapturingArg
PredicateOrigin
PrimTy
Not represented directly in the AST; referred to by name through a ty_path.
QPath
Represents an optionally Self-qualified value/type path or associated extension.
RangeEnd
RpitContext
Safety
StmtKind
The contents of a statement.
StructTailExpr
Term
TraitFn
Represents a trait method’s body (or just argument names).
TraitItemKind
Represents a trait method or associated constant or type
TyKind
The various kinds of types recognized by the compiler.
UnOp
Unary operator.
UnsafeBinderCastKind
Whether we’re unwrapping or wrapping an unsafe binder
UnsafeSource
UseKind
VariantData
Fields and constructor IDs of enum variants and structs.
WherePredicateKind
The kind of a single predicate in a where-clause.
YieldSource
The yield kind that caused an ExprKind::Yield.

Functions§

debug_fn đź”’
expect_failed đź”’
expr_needs_parens
Checks if the specified expression needs parentheses for prefix or postfix suggestions to be valid. For example, a + b requires parentheses to suggest &(a + b), but just a does not. Similarly, (a + b).c() also requires parentheses. This should not be used for other types of suggestions.
is_range_literal
Checks if the specified expression is a built-in range literal. (See: LoweringContext::lower_expr()).

Type Aliases§

BinOp
GenericBounds
Lit
A literal.
UsePath
Up to three resolutions for type, value and macro namespaces.