Skip to main content

Module alias

Module alias 

Source
Expand description

Alias checks combining VM provenance with MIR hazard analysis.

Trace a pointer’s allocation back to its source, then check whether a reference view, ownership transfer, read, or copy violates Alias.

Re-exportsΒ§

use crate::analysis::alias::hazard as alias_hazard; πŸ”’
use crate::analysis::alias::hazard::AliasProducer; πŸ”’
use crate::analysis::alias::hazard::HazardKind; πŸ”’
use crate::analysis::alias::FieldOrigin; πŸ”’
use crate::analysis::dataflow::pointer_flow; πŸ”’
use crate::compat::GenericArgsRef; πŸ”’
use crate::def_ids::type_ids; πŸ”’
use crate::util::def_use::PlaceKey; πŸ”’
use crate::util::mir_utils; πŸ”’
use crate::verify::checkpoint::Checkpoint; πŸ”’
use crate::vm::state::VmExecutor; πŸ”’
use crate::vm::state::VmValue; πŸ”’
use rustc_hir::def_id::DefId; πŸ”’
use rustc_middle::mir::Local; πŸ”’
use rustc_middle::mir::Operand; πŸ”’
use rustc_middle::mir::ProjectionElem; πŸ”’
use rustc_middle::mir::Rvalue; πŸ”’
use rustc_middle::mir::StatementKind; πŸ”’

StructsΒ§

VmOrigin πŸ”’
Information about a value’s ultimate origin.

EnumsΒ§

VmAliasResult πŸ”’
Result of an Alias check using VM state.
VmOriginKind πŸ”’

FunctionsΒ§

check_alias_vm πŸ”’
Run the full alias hazard check for the VM backend.
check_copy_memory_alias πŸ”’
check_escaped_field πŸ”’
Shared escape + field-encapsulation check: a view that escapes and traces to a struct field is safe only if the field is private and not written/exposed by safe code. A unique (&mut) view escaping through a private raw field is still unsound β€” the caller can re-enter and obtain a second &mut.
check_ownership_transfer_alias πŸ”’
check_read_memory_alias πŸ”’
check_view_alias πŸ”’
escape_region_violation πŸ”’
Check whether the shared view’s claimed return region outlives the source reference local’s region. Returns a violation reason when it does.
escaped_parameter_origin πŸ”’
find_struct_field_origin_for_param πŸ”’
Find a self field origin through the checkpoint argument or a copied local.
flow_xor_violation πŸ”’
Flow-sensitive shared-XOR-mutable check for a view-producing checkpoint. Walks the VM’s current locals (not a static derivation tree), grouping a live reference view as conflicting when it names the same allocation, or a sub-allocation of it (root_alloc β€” from_raw_parts/split_at keep a parent edge), with the opposite mutability.
is_self_field_shared_ref πŸ”’
Check whether a self field’s type is a shared reference (&T or &[T]). Used by raw-ptr-deref alias checks to prove shared views are safe when the underlying field is a shared reference.
origin_alias_hazard_accepted πŸ”’
resolve_escaped_field_origin πŸ”’
Resolve the struct field an escaping view came from: try the derivation tree first (via the resolved and raw origins), then fall back to self-type heuristics when tree resolution fails to reach a field.
resolve_origin_place_mir πŸ”’
Trace a local through copies and casts (e.g. _tmp = self.ptr β†’ _1.0).
self_adt πŸ”’
Extract the &self/&mut self receiver’s ADT (peeling one reference layer), or None for non-ADT receivers. Shared by the struct-field origin heuristics.
self_field_origin πŸ”’
shared_view_escape_region_violation πŸ”’
A shared view re-borrowed from the reference parameter local and returned must not claim a region that outlives the parameter’s own region. Returns a violation reason when local’s region does not outlive the return region.