Skip to main content

Module state

Module state 

Source
Expand description

Supporting symbolic VM state types and operations.

Symbolic values, memory allocations, and operations on VmExecutor live here; the core state and its constructor are defined in the parent module.

Re-exportsΒ§

use crate::def_ids::type_ids; πŸ”’
use crate::util::mir_utils; πŸ”’
use rustc_abi::VariantIdx; πŸ”’
use rustc_hir::def_id::DefId; πŸ”’
use rustc_middle::mir::Body; πŸ”’
use rustc_middle::mir::ConstValue; πŸ”’
use rustc_middle::mir::Local; πŸ”’
use rustc_middle::mir::Operand; πŸ”’
use rustc_middle::mir::Place; πŸ”’
use rustc_middle::mir::ProjectionElem; πŸ”’
use rustc_middle::ty::Region; πŸ”’
use rustc_middle::ty::Ty; πŸ”’
use rustc_middle::ty::TyKind; πŸ”’
use rustc_middle::ty::TypingEnv; πŸ”’
use rustc_span::Span; πŸ”’
use z3::SatResult; πŸ”’
use z3::Solver; πŸ”’
use z3::ast::Array; πŸ”’
use z3::ast::Ast; πŸ”’
use z3::ast::Bool; πŸ”’
use z3::ast::Dynamic; πŸ”’
use z3::ast::Int; πŸ”’
use crate::compat::FxHashMap; πŸ”’
use crate::compat::FxHashSet; πŸ”’
pub(crate) use super::VmExecutor; πŸ”’
use crate::util::def_use::PlaceKey; πŸ”’

StructsΒ§

AllocFacts πŸ”’
Per-allocation lifecycle facts (dead/liveness/for_each), kept apart from the allocation’s shape metadata and parent edge so identity/layout and facts are separated at the type level. The content facts (readability, C-string/UTF-8 trust) live on ContentFacts instead.
AllocId πŸ”’
Unique identifier for a heap or stack allocation.
Allocation πŸ”’
A memory allocation: a stack local, a heap object (Box/Vec), or an external raw-pointer placeholder.
Constraints πŸ”’
Accumulated solver state for the current path.
ContentFacts πŸ”’
Per-allocation content facts: whether the allocation’s contents are readable (initialized), whether they were asserted to be a valid C string / UTF-8, and whether they were licensed for SplitTransmute re-interpretation. These describe the stored bytes/values, so they live on MemoryContent next to that data, rather than on AllocFacts (lifecycle).
ForEachFacts πŸ”’
Uniform facts about the pointer elements of a container, established by x.iter() for_each invariants.
FrameState πŸ”’
The frame-scoped subset of VmExecutor: the name β†’ allocation binding keyed by MIR Local, which the callee reuses, so it must be swapped out for the duration of an inlined callee and swapped back afterwards.
InlineCtx πŸ”’
Scratch state shared by recursive inlining and path replay. Recursive inlining saves caller bindings on the Rust call stack; path replay saves them with the caller frame in SavedCallerFrame.
MemoryContent πŸ”’
The per-allocation byte and typed-value layers. Typed values use a view type so fields from different casts do not collide. Unwritten bytes read as the UNINIT sentinel.
MemoryEvent πŸ”’
MemoryUnit πŸ”’
A single allocation: its shape metadata (Allocation) plus its contents (MemoryContent). Splitting the two keeps the identity/layout facts apart from the mutable memory the values live in, while colocating them in one unit so no parallel table can drift out of sync. Facts live in three anchored layers β€” lifecycle (AllocFacts), content (ContentFacts), and value (ValueFacts on each VmValue) β€” see each type’s doc.
OwnershipTransfer πŸ”’
A transferable ownership share. Copies of its pointer use the same entry.
Provenance πŸ”’
Pointer provenance: which allocation, at what byte offset, and (when known) what structure that offset has.
SavedCallerFrame πŸ”’
Caller state parked during a path-replay call.
TermCaches πŸ”’
Term-provenance caches, one per phenomenon the VM must shape by hand.
ValueFacts πŸ”’
Value-level facts about a single symbolic value (nullness, alignment, bounds, and whether it has been written). These travel with the value β€” a VmValue leaves its allocation when passed as an operand or stashed in InlineCtx::deferred_field_writes β€” so they live on the value, not the allocation. The allocation-level counterpart to init is ContentFacts::initialized, kept in sync by VmExecutor::mark_initialized.
VmValue πŸ”’
A symbolic value tracked by the VM.

EnumsΒ§

AllocKind πŸ”’
The shape of an allocation: a single object, a slice/array buffer, or an external raw-pointer parameter. element_ty (typed vs untyped) and the parent sub-view edge stay separate fields.
ElementTy πŸ”’
The element type of an allocation’s contents, either a concrete [Ty] or symbolic (Generic).
MemoryEventKind πŸ”’
Memory operations observed while executing a MIR path.
OffsetKind πŸ”’
The structure of a pointer’s byte offset, when it has one.
ValueSource πŸ”’
The extra semantics attached to a value, beyond its term/type/provenance.

ConstantsΒ§

REPEATED_ARRAY_ELEMENT πŸ”’