Skip to main content

Module hazard

Module hazard 

Source
Expand description

MIR-level alias hazard analysis independent of VM state and Z3 terms.

Re-exportsΒ§

use crate::def_ids::type_ids; πŸ”’
use crate::analysis::dataflow::call_read; πŸ”’
use crate::analysis::dataflow::call_write; πŸ”’
use crate::analysis::dataflow::pointer_copy; πŸ”’
use crate::analysis::dataflow::pointer_flow; πŸ”’
use crate::analysis::dataflow::pointer_flow::trace_source_arg; πŸ”’
use crate::util::mir_utils; πŸ”’
use crate::analysis::dataflow::call_summary::VerifierCallSemantics; πŸ”’
use crate::analysis::dataflow::call_summary::pointer_semantics; πŸ”’
use crate::contract::PropertyKind; πŸ”’
use std::collections::HashMap; πŸ”’
use std::collections::HashSet; πŸ”’
use rustc_hir::Safety; πŸ”’
use rustc_hir::def::DefKind; πŸ”’
use rustc_hir::def_id::DefId; πŸ”’
use rustc_middle::mir::BasicBlock; πŸ”’
use rustc_middle::mir::Body; πŸ”’
use rustc_middle::mir::Local; πŸ”’
use rustc_middle::mir::LocalDecls; πŸ”’
use rustc_middle::mir::Operand; πŸ”’
use rustc_middle::mir::Place; πŸ”’
use rustc_middle::mir::ProjectionElem; πŸ”’
use rustc_middle::mir::Rvalue; πŸ”’
use rustc_middle::mir::StatementKind; πŸ”’
use rustc_middle::mir::TerminatorKind; πŸ”’
use rustc_middle::ty; πŸ”’
use rustc_middle::ty::AssocKind; πŸ”’
use rustc_middle::ty::TyCtxt; πŸ”’
use rustc_middle::ty::TyKind; πŸ”’
use crate::analysis::alias::FieldOrigin; πŸ”’
use crate::analysis::alias::resolve_any_field_origin; πŸ”’
use crate::analysis::alias::resolve_self_field_origin; πŸ”’
use crate::util::fn_info::is_externally_reachable; πŸ”’
use crate::util::def_use::PlaceBaseKey; πŸ”’
use crate::util::def_use::PlaceKey; πŸ”’
use crate::util::mir_scan::get_fn_safety; πŸ”’
pub(crate) use crate::util::mir_utils::operand_mir_place; πŸ”’
pub(crate) use crate::util::mir_utils::operand_place; πŸ”’
use crate::util::mir_utils::blocks_reachable_after_call; πŸ”’
use crate::util::mir_utils::rvalue_any_place_matching; πŸ”’

StructsΒ§

LocalCallsite πŸ”’

EnumsΒ§

AliasProducer πŸ”’
HazardCheck πŸ”’
HazardKind πŸ”’
RawAccessKind πŸ”’

FunctionsΒ§

alias_producer πŸ”’
alias_proved_for_param_local πŸ”’
any_struct_field_origin πŸ”’
callsite_arg_origins πŸ”’
check_fn_against_field πŸ”’
Check whether item (a struct method or a same-module free function) writes or exposes the raw field origin through the borrow carried by self_local. A shared current borrow (&self) is not invalidated by a mutable item borrow (&mut self), and a mutable/mutable pair is likewise fine; any other combination is a violation. Returns the violation description, or None.
destination_flows_to_return πŸ”’
escaped_self_field_violation πŸ”’
expand_hazard_alias_locals πŸ”’
expand_origin_aliases πŸ”’
find_as_ptr_receivers πŸ”’
free_fns_for_struct πŸ”’
Collect the free functions in the struct’s own module that take a &Struct / &mut Struct parameter. Rust privacy is module-scoped, so only those can reach a private raw field. Each entry pairs the function with the parameter locals that carry the struct reference.
hazard_used_after_block πŸ”’
hazard_used_after_statement πŸ”’
impls_for_struct πŸ”’
is_origin_a_reference πŸ”’
is_ptr_add_offset_eq πŸ”’
is_ptr_from_ptr_add πŸ”’
kill_strongly_updated_origins πŸ”’
live_locals_at πŸ”’
Compute the set of locals that are live (between StorageLive and StorageDead) at the deref point (call_block, stmt_index), scanning the function in execution order up to that point. Used by the callsite shared-XOR-mutable check to ignore temporaries that have already gone dead (e.g. a method call’s &self receiver).
local_callsites πŸ”’
local_hazard_violation πŸ”’
local_hazard_violation_with πŸ”’
local_traces_to_self_field πŸ”’
Backward-traces local through MIR assignments to check whether its value is derived from (*self_local).field_index.
method_exposes_self_field πŸ”’
Whether method returns a raw-pointer-bearing value derived from the field field_index of the struct borrowed via self_local, i.e. it leaks the raw field to the caller.
method_writes_self_field πŸ”’
Whether method writes through the raw field field_index of the struct borrowed via self_local (_1 for a method, any parameter for a free fn).
opaque_ownership_source_arg πŸ”’
operand_local πŸ”’
ownership_transfer_source_arg πŸ”’
ownership_transfer_violation πŸ”’
param_index_of_origin πŸ”’
Return the 0-based argument index for origin when it is a direct, whole raw-pointer parameter (no field projections, no local-copy tracing).
place_is_raw_access_to_any_origin πŸ”’
place_is_raw_access_to_live_origin πŸ”’
place_is_raw_access_to_origin πŸ”’
place_key_is_prefix_of πŸ”’
place_raw_accesses_self_field πŸ”’
Whether place is a raw-pointer deref whose operand traces back to the field field_index of the struct borrowed via self_local.
places_holding_transferred_pointer πŸ”’
pointer_result_source_arg πŸ”’
pre_existing_view_on_origin πŸ”’
private_fn_callsite_delegation πŸ”’
public_raw_field πŸ”’
raw_access_conflicts πŸ”’
raw_pointer_view_from_mir πŸ”’
Recognize a returned reference formed by dereferencing a raw pointer derived from one of the callee’s raw-pointer parameters.
reconstructed_owner πŸ”’
resolve_mir_place_tree πŸ”’
Resolve a MIR place through the alias tree: a field-projected place resolves to itself; a whole-local place resolves to its ultimate origin.
resolve_param_origin πŸ”’
Resolve origin to a parameter MIR local, tracing through local-copy origins when the base is not itself a parameter.
resolve_place_key_tree πŸ”’
Resolve a place’s local through the alias tree (ignoring the place’s own field projections), falling back to the MIR place itself when unmapped.
resolve_via_tree πŸ”’
Resolve (local, fields) through the alias tree: a place that already names a field path resolves to itself; a whole-local place resolves to its ultimate (root, fields) origin.
reverse_postorder_blocks πŸ”’
rvalue_copies_live_origin_value πŸ”’
rvalue_mentions_any_local πŸ”’
rvalue_mentions_local πŸ”’
rvalue_mentions_origin πŸ”’
rvalue_reads_any_origin πŸ”’
rvalue_reads_like_view πŸ”’
self_borrow_mutability πŸ”’
The mutability (Not / Mut) of the borrow carried by self_local’s type (a &T / &mut T), or None if it is not a reference. self_local is _1 for a method receiver, and any parameter for a free function.
self_field_key πŸ”’
The PlaceKey for (*self_local).field_index.
self_field_origin πŸ”’
share_transfer_source_arg πŸ”’
splice_holder_fields πŸ”’
statement_uses_any_local πŸ”’
struct_ref_param_locals πŸ”’
Return the parameter locals of def_id whose type is a &Struct / &mut Struct reference to struct_def_id.
terminator_invalidates_vec_owner πŸ”’
terminator_is_benign_origin_use πŸ”’
terminator_uses_any_local πŸ”’
terminator_uses_live_origin πŸ”’
terminator_uses_origin πŸ”’
terminator_writes_origin πŸ”’
trace_owned_field πŸ”’
trace_returned_ref πŸ”’