Skip to main content

Module mir

Module mir 

Source
Expand description

Mid-level Intermediate Representation (MIR) for borrow checking.

Shape compiles AST → MIR → bytecode. The MIR is a CFG-based IR used by:

  • The Datafrog borrow solver (NLL borrow checking)
  • Liveness analysis (smart move/clone inference)
  • The repair engine (error fix candidate generation)

The MIR is lowered from AST before bytecode compilation. Analysis results (BorrowAnalysis) are shared by the compiler, LSP, and diagnostic engine.

Re-exports§

pub use analysis::BorrowAnalysis;
pub use analysis::BorrowErrorCode;
pub use analysis::BorrowErrorKind;
pub use analysis::FunctionBorrowSummary;
pub use cfg::ControlFlowGraph;
pub use field_analysis::FieldAnalysis;
pub use liveness::LivenessResult;
pub use storage_planning::StoragePlan;
pub use types::*;

Modules§

analysis
Borrow analysis results — the single source of truth.
cfg
Control Flow Graph construction and traversal for MIR.
field_analysis
Field-level definite assignment and liveness analysis on MIR.
liveness
Liveness analysis on MIR.
lowering
MIR lowering: AST -> MIR.
repair
Repair engine for borrow errors.
solver
Datafrog-based NLL borrow solver.
storage_planning
Storage Planning Pass — decides the runtime storage class for each binding.
types
Core MIR types: Place, Statement, Terminator, BasicBlock.