Collect all basic blocks reachable after a call blockβs normal return, or β
for a non-call block such as a raw-pointer deref statement β after the block
itself (all of its successors).
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.
Like dep_callee_def_id, but resolves trait-method callees to their
concrete impl so cross-crate Deref/DerefMut bodies β whose trait-method
DefId has no available MIR β can still be inlined.
Resolve an array length const (ty::Const) to a concrete u64. Unlike
try_to_target_usize, this also evaluates unevaluated const expressions
(e.g. [MaybeUninit<K>; CAPACITY] where CAPACITY = 2 * B - 1), so the
VM can allocate the array with its true element count instead of a
collapsed zero-size fallback.
Whether def_id is slice::Iter/IterMutβs private post_inc_start
helper (a pointer-advancing side effect that cannot be inlined because of
its ZST SwitchInt branch).
Whether def_id is a single-field struct wrapping a raw pointer (i.e.
NonNull-shaped). Used by alias/ownership reasoning to recognize pointer
wrappers β including local re-implementations β by their structure rather
than by a std DefId.
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.
Max align_of over all implementors of a generic type parameterβs trait
bounds (0 for non-param types or a parameter without a bounded set of
implementors).
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.
Resolve a (possibly trait-method) callee to the concrete impl method that
will actually be dispatched, given the caller context and the calleeβs
generic arguments. Returns None when the callee cannot be resolved to a
distinct concrete item (e.g. still generic/virtual), or is not a trait
method at all (callers should then keep the original DefId).
Resolve a const item (e.g. const CAPACITY: usize = 2 * B - 1) by name in
the local crate to its evaluated unsigned-integer value, for use in the
contract DSL (ValidNum(len <= CAPACITY)).
Resolve a cfg!-style runtime-check flag (UbChecks, ContractChecks,
OverflowChecks) to a constant u64. We fold to the no-check edge (0):
the check only panics on a violated precondition, and its branchy body would
otherwise corrupt field/Typed propagation during inlining. Older rustc lowers
these to Rvalue::NullaryOp(NullOp::RuntimeChecks); newer rustc lowers them
to Operand::RuntimeChecks.
Whether a blockβs SwitchInt is a debug_assert!-style dispatch (all
non-otherwise targets are panic/unreachable), or has a constant /
runtime-check discriminant that folds to a single live edge. Such a switch
is dead on the normal path and is safe to ignore when inlining.
Whether a SwitchIntβs non-otherwise targets all lead straight to
panic/unreachable (a debug_assert!/assert! dispatch). Such a switch
is dead on the normal path and can be inlined by following only the
otherwise edge.
Whether a type transitively contains a raw pointer, recursing through tuple
elements and Adt fields. Unlike type_contains_reference, this does not
match references β a method returning &*self.raw re-borrows the pointee
(safe) rather than leaking the raw pointer value itself (unsafe).