Skip to main content

Module alias

Module alias 

Source
Expand description

VM-specific alias origin tracing.

Bridges VmState provenance tracking with the shared alias_hazard MIR scanning infrastructure. The VM already tracks which AllocId each localโ€™s value points to; this module traces that provenance back to the originating parameter/local.

Structsยง

VmOrigin ๐Ÿ”’
Information about a valueโ€™s ultimate origin.

Enumsยง

VmAliasResult ๐Ÿ”’
Result of the VM-based alias check.
VmOriginKind ๐Ÿ”’

Functionsยง

check_alias_vm ๐Ÿ”’
Run the full alias hazard check for the VM backend.
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.
find_struct_field_origin_for_param ๐Ÿ”’
Attempt to extract the MIR local index from an operand for PlaceKey construction. Try to find a struct field origin by examining checkpoint arguments and the functionโ€™s self type. Handles the case where origin tracing fails to resolve through intermediate locals.
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.
fn_has_alias_requires ๐Ÿ”’
Whether the caller declares an Alias assumption in its #[rapx::requires] (directly or via a compound like Ptr2Ref). Such a function relies on its caller-guaranteed precondition rather than on field encapsulation, so the field-encapsulation escape check must not fire on it.
infer_self_field_from_type ๐Ÿ”’
When origin tracing fails to resolve the exact struct field, try to infer it from the functionโ€™s self type. Looks for a raw pointer field in the struct โ€” for simple wrappers with a single raw pointer field, this works reliably.
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.
property_contains_alias ๐Ÿ”’
Whether a contract property tree contains an Alias atom (used to detect a caller-declared Alias/Ptr2Ref precondition).
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 ๐Ÿ”’
copies/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.
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.