Expand description
MIR datatypes and passes. See the rustc dev guide for more info.
Re-exports§
- pub use self::graphviz::write_mir_graphviz;
- pub use self::pretty::MirDumper;
- pub use self::pretty::PassWhere;
- pub use self::pretty::display_allocation;
- pub use self::pretty::write_mir_pretty;
Modules§
- basic_blocks 🔒
- binding_form_ 🔒impl 
- consts 🔒
- coverage
- Metadata from source code coverage analysis and instrumentation.
- generic_graph 🔒
- generic_graphviz 
- graphviz
- interpret
- An interpreter for MIR used in CTFE and by miri.
- loops
- mono
- pretty
- query 🔒
- Values computed by queries that use MIR.
- size_asserts 🔒
- statement 🔒
- Functionality for statements, operands, places, and things that appear in them.
- syntax 🔒
- This defines the syntax of MIR, i.e., the set of available MIR operations, and other definitions closely related to MIR semantics. This is in a dedicated file so that changes to this file can be reviewed more carefully. The intention is that this file only contains datatype declarations, no code.
- terminator 🔒
- Functionality for terminators and helper types that appear in terminators.
- traversal
- visit
- The MIR Visitor
Structs§
- BasicBlock 
- A node in the MIR control-flow graph.
- BasicBlock Data 
- Data for a basic block, including a list of its statements.
- BasicBlocks 
- BlockTail Info 
- BlockTailInfois attached to the- LocalDeclfor temporaries created during evaluation of expressions in a block tail expression; that is, a block like- { STMT_1; STMT_2; EXPR }.
- Body
- The lowered representation of a single function.
- ConcreteOpaque Types 
- All the opaque types that are restricted to concrete types
by this function. Unlike the value in TypeckResults, this has unerased regions.
- ConstAlloc 
- Evaluated Constants
Represents the result of const evaluation via the eval_to_allocationquery. Not to be confused withConstAllocation, which directly refers to the underlying data! Here we indirect via anAllocId.
- ConstOperand 
- ConstQualifs 
- The result of the mir_const_qualifquery.
- CopyNonOverlapping 
- CoroutineInfo 
- Additional information carried by a MIR body when it is lowered from a coroutine.
This information is modified as it is lowered during the StateTransformMIR pass, so not all fields will be active at a given time. For example, theyield_tyis taken out of the field after yields are turned into returns, and thecoroutine_dropbody is only populated after the state transform pass.
- CoroutineLayout 
- The layout of coroutine state.
- CoroutineSaved Local 
- CoroutineSaved Ty 
- DestructuredConstant 
- The constituent parts of a mir constant of kind ADT or array.
- Local
- LocalDecl 
- A MIR local.
- Location
- Locationrepresents the position of the start of the statement; or, if- statement_indexequals the number of statements, then the start of the terminator.
- MirSource
- Where a specific mir::Bodycomes from.
- Place
- Places roughly correspond to a “location in memory.” Places in MIR are the same mathematical object as places in Rust. This of course means that what exactly they are is undecided and part of the Rust memory model. However, they will likely contain at least the following pieces of information in some form:
- PlaceRef 
- PlaceTy
- Promoted
- SourceInfo 
- Grouped information about the source code origin of a MIR entity. Intended to be inspected by diagnostics and debuginfo. Most passes can work with it as a whole, within a single function.
- SourceScope 
- SourceScope Data 
- SourceScope Local Data 
- Statement
- A statement in a basic block, including information about its source code.
- SwitchTargets 
- SwitchTargets Iter 
- Terminator
- UnevaluatedConst 
- An unevaluated (potentially generic) constant used in MIR.
- UserType Projection 
- Encodes the effect of a user-supplied type annotation on the
subcomponents of a pattern. The effect is determined by applying the
given list of projections to some underlying base type. Often,
the projection element list projsis empty, in which case this directly encodes a type inbase. But in the case of complex patterns with subpatterns and bindings, we want to apply only a part of the type to a variable, in which case theprojsvector is used.
- UserType Projections 
- A collection of projections into user types.
- VarBindingForm 
- VarDebugInfo 
- Debug information pertaining to a user variable.
- VarDebugInfo Fragment 
Enums§
- AggregateKind 
- AnalysisPhase 
- See MirPhase::Analysis.
- AnnotationSource 
- AssertKind 
- Information about an assertion failure.
- AssignOp 
- BackwardIncompatible Drop Reason 
- BinOp
- BindingForm 
- BorrowKind 
- CallReturn Places 
- List of places that are written to after a successful (non-unwind) return
from a Call,YieldorInlineAsm.
- CallSource 
- Represents how a TerminatorKind::Callwas constructed. Used only for diagnostics.
- CastKind 
- ClearCross Crate 
- CoercionSource 
- Represents how a CastKind::PointerCoercionwas constructed. Used only for diagnostics.
- Const
- Constants
- ConstValue 
- Represents a constant value in Rust. ScalarandSliceare optimizations for array length computations, enum discriminants and the pattern matching logic.
- ConstraintCategory 
- Outlives-constraints can be categorized to determine whether and why they are interesting (for error reporting). Order of variants indicates sort order of the category, thereby influencing diagnostic output.
- DefLocation
- DefLocationrepresents the location of a definition - either an argument or an assignment within MIR body.
- FakeBorrow Kind 
- FakeRead Cause 
- The FakeReadCausedescribes the type of pattern why a FakeRead statement exists.
- InlineAsmMacro 
- The macro that an inline assembly block was created by
- InlineAsmOperand 
- LocalInfo 
- Extra information about a some locals that’s used for diagnostics and for classifying variables into local variables, statics, etc, which is needed e.g. for borrow checking.
- LocalKind 
- Classifies locals into categories. See Body::local_kind.
- MentionedItem 
- Some item that needs to monomorphize successfully for a MIR body to be considered well-formed.
- MirPhase
- Represents the “flavors” of MIR.
- MutBorrowKind 
- Mutability
- NonDivergingIntrinsic 
- NullOp
- Operand
- An operand in MIR represents a “value” in Rust, the definition of which is undecided and part of the memory model. One proposal for a definition of values can be found on UCG.
- ProjectionElem 
- RawPtrKind 
- RetagKind 
- Describes what kind of retag is to be performed.
- ReturnConstraint 
- RuntimePhase 
- See MirPhase::Runtime.
- Rvalue
- The various kinds of rvalues that can appear in MIR.
- RvalueInitialization State 
- StatementKind 
- The various kinds of statements that can appear in MIR.
- SwitchTarget Value 
- TerminatorEdges 
- TerminatorKind 
- The various kinds of terminators, representing ways of exiting from a basic block.
- UnOp
- UnwindAction 
- Action to be taken when a stack unwind happens.
- UnwindTerminate Reason 
- The reason we are terminating the process during unwinding.
- VarDebugInfo Contents 
Constants§
- OUTERMOST_SOURCE_ SCOPE 
- RETURN_PLACE 
- START_BLOCK 
- TAG_CLEAR_ 🔒CROSS_ CRATE_ CLEAR 
- TAG_CLEAR_ 🔒CROSS_ CRATE_ SET 
Traits§
Functions§
- find_self_ call 
- Checks if the specified localis used as theselfparameter of a method call in the providedBasicBlock. If it is, then theDefIdof the called method is returned.
- graphviz_safe_ def_ name 
Type Aliases§
- AssertMessage 
- Type for MIR Assertterminator error messages.
- LocalDecls 
- Types for locals
- PlaceElem 
- Alias for projections as they appear in places, where the base is a place and the index is a local.
- ProjectionKind 
- Alias for projections as they appear in UserTypeProjection, where we need neither theVparameter forIndexnor theTforField.
- Successors