Skip to main content

Module mir_utils

Module mir_utils 

Source

Functions§

alloc_id_bytes
Read bytes from a global allocation.
arg_of_local
Return the zero-based argument index of local, if it is a MIR argument.
blocks_reachable_after_call
Collect all basic blocks reachable after (and including) a call block.
call_destination
Return the destination local for a checkpoint’s call or deref.
call_name
Return a stable, human-readable name for a MIR call operand.
callee_is_linear
Return true when def_id’s MIR body is “linear” enough for lightweight inlining: no SwitchInt terminators, at most one return, and at most max_blocks basic blocks.
callee_param_index_for_local
Return the callee argument index represented by a MIR local.
catch_panic 🔒
Run f inside catch_unwind, returning either the result or the downcasted panic message.
collect_place_aliases
Build a mapping from MIR locals to their resolved PlaceKey origins.
collect_return_block_indices
Collect all return basic block indices for a function body.
const_int_from_debug
Parse an integer from a MIR constant’s Debug text. Handles decimal, 0x hex, and Value(...) forms.
const_scalar_int
Resolve a MIR constant to a concrete integer, falling back from the cheap debug-text parse to full const evaluation.
const_value_bytes
Extract raw bytes from a ConstValue, following reference indirection.
deep_resolve_place
Follow local-origin associations transitively to resolve to the ultimate source (parameter or root local) and accumulated field path.
dep_callee_def_id 🔒
destination_stride
extract_const_bytes_from_operand
Try to extract raw bytes from a MIR constant operand that is a reference to a byte array/slice (e.g. b"hello\0"). Returns the byte values. Used by the VM to populate byte-level tracking for constant C strings.
extract_local
Extract the bare local from a Copy/Move operand with no projection.
extract_operand_const
Extract a constant u64 value from an operand, if it’s a known constant.
field_offset_in_bytes
Byte offset of a struct field within its container type (0 on failure).
get_owner_struct_def_id
has_crate
has_rapx_verify_attr
is_const_def_kind 🔒
Whether a DefId is a const-like item that mir_for_ctfe accepts.
is_std_crate_def_id
is_trait_unsafe
is_u8_array_or_slice
Whether a type is a u8 array ([u8; N]) or u8 slice ([u8]).
layout_of_ty
Compute the full type layout, catching rustc panics and layout errors. Shared by type_layout and the symbolic VM’s size/align/field-offset queries so the layout_of call and its panic-guard live in one place.
min_align_of_generic_param
Min align_of over all implementors of a generic type parameter’s trait bounds (0 for non-param types).
nonnull_inner_ty
offset_of_container 🔒
If constant is a promoted offset_of!(Container, field) constant (an unevaluated Const whose body is a call to the offset_of intrinsic), return the container type.
offset_of_ty_from_func 🔒
operand_mir_place
Extract the MIR Place from an operand.
operand_place
Extract a PlaceKey from a MIR operand.
pointee_alignment
pointee_ty 🔒
resolve_impl_self_ty_def_id
resolve_mir_place
Resolve a MIR place through alias mapping to get a canonical PlaceKey.
rvalue_any_place_matching
Check whether any MIR place used in an rvalue matches a predicate.
rvalue_source_place
Extracts the source Place from an rvalue for simple forwarding operations (copy, move, cast, reference, raw-pointer, copy-for-deref).
size_of_generic_param
Max size_of over all implementors of a generic type parameter’s trait bounds (0 for non-param types).
slice_element_size
trace_place_root
Trace a place back to its root local via local origin map.
trace_raw_ptr_through_call
Trace a raw pointer local back through call terminators to find the originating place (e.g. slice from get_unchecked).
ty_has_param_const 🔒
True when a type transitively contains a const-generic parameter or an associated type alias (which may be layout-ambiguous).
type_contains_reference
Whether a type transitively contains a reference.
type_layout
vec_elem_ty
Element type of a Vec<T>, if ty is a Vec.
vec_element_size