[][src]Module rustc_mir::hair

⚙️ 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 MIR is built from some high-level abstract IR (HAIR). This section defines the HAIR along with a trait for accessing it. The intention is to allow MIR construction to be unit-tested and separated from the Rust source and compiler data structures.

Re-exports

pub use self::pattern::BindingMode;
pub use self::pattern::Pat;
pub use self::pattern::PatKind;
pub use self::pattern::PatRange;
pub use self::pattern::FieldPat;

Modules

constantInternal
cxInternal

This module contains the fcuntaiontliy to convert from the wacky tcx data structures into the HAIR. The builder is generally ignorant of the tcx, etc., and instead goes through the Cx for most of its work.

patternInternal

Validation of patterns/matches.

utilInternal

Structs

ArmInternal
BlockInternal
ExprInternal

The Hair trait implementor lowers their expressions (&'tcx H::Expr) into instances of this Expr enum. This lowering can be done basically as lazily or as eagerly as desired: every recursive reference to an expression in this enum is an ExprRef<'tcx>, which may in turn be another instance of this enum (boxed), or else an unlowered &'tcx H::Expr. Note that instances of Expr are very short-lived. They are created by Hair::to_expr, analyzed and converted into MIR, and then discarded.

FieldExprRefInternal
FruInfoInternal
StmtInternal

Enums

BlockSafetyInternal
ExprKindInternal
ExprRefInternal
GuardInternal
LintLevelInternal
LogicalOpInternal
StmtKindInternal
StmtRefInternal

Traits

MirrorInternal

"Mirroring" is the process of converting from a HIR type into one of the HAIR types defined in this file. This is basically a "on the fly" desugaring step that hides a lot of the messiness in the tcx. For example, the mirror of a &'tcx hir::Expr is an Expr<'tcx>.