Expand description
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.
Re-exportsΒ§
use rustc_abi::FieldIdx;πuse rustc_abi::VariantIdx;πuse rustc_ast::InlineAsmOptions;πuse rustc_ast::InlineAsmTemplatePiece;πuse rustc_ast::Mutability;πuse rustc_attr_ir::UnrollAttr;πuse rustc_data_structures::packed::Pu128;πuse rustc_hir::CoroutineKind;πuse rustc_hir::def_id::DefId;πuse rustc_index::IndexVec;πuse rustc_macros::StableHash;πuse rustc_macros::TyDecodable;πuse rustc_macros::TyEncodable;πuse rustc_macros::TypeFoldable;πuse rustc_macros::TypeVisitable;πuse rustc_span::def_id::LocalDefId;πuse rustc_span::Span;πuse rustc_span::Spanned;πuse rustc_span::Symbol;πuse rustc_target::asm::InlineAsmRegOrRegClass;πuse smallvec::SmallVec;πuse thin_vec::ThinVec;πuse super::BasicBlock;πuse super::Const;πuse super::Local;πuse super::UserTypeProjection;πuse crate::mir::coverage::CoverageKind;πuse crate::ty::adjustment::PointerCoercion;πuse crate::ty;πuse crate::ty::GenericArgs;πuse crate::ty::List;πuse crate::ty::Region;πuse crate::ty::Ty;πuse crate::ty::UserTypeAnnotationIndex;π
ModulesΒ§
- size_
asserts π
StructsΒ§
- Const
Operand - Copy
NonOverlapping - 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:
- Switch
Targets
EnumsΒ§
- Aggregate
Kind - Analysis
Phase - See
MirPhase::Analysis. - Assert
Kind - Information about an assertion failure.
- Assign
Op - Backward
Incompatible Drop Reason - BinOp
- Borrow
Kind - Call
Source - Represents how a
TerminatorKind::Callwas constructed. Used only for diagnostics. - Cast
Kind - Coercion
Source - Represents how a
CastKind::PointerCoercionwas constructed. Used only for diagnostics. - Fake
Borrow Kind - Fake
Read Cause - The
FakeReadCausedescribes the type of pattern why a FakeRead statement exists. - Inline
AsmMacro - The macro that an inline assembly block was created by
- Inline
AsmOperand - MirPhase
- Represents the βflavorsβ of MIR.
- MutBorrow
Kind - NonDiverging
Intrinsic - 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.
- Projection
Elem - RawPtr
Kind - Runtime
Checks - Runtime
Phase - See
MirPhase::Runtime. - Rvalue
- The various kinds of rvalues that can appear in MIR.
- Statement
Kind - The various kinds of statements that can appear in MIR.
- Terminator
Kind - The various kinds of terminators, representing ways of exiting from a basic block.
- UnOp
- Unwind
Action - Action to be taken when a stack unwind happens.
- Unwind
Terminate Reason - The reason we are terminating the process during unwinding.
- With
Retag - Describes whether this operand use performs a retag.
Type AliasesΒ§
- Assert
Message - Type for MIR
Assertterminator error messages. - Place
Elem - Alias for projections as they appear in places, where the base is a place and the index is a local.