pub(crate) struct Allocation<'z3, 'tcx> {
pub base: Int<'z3>,
pub size: Int<'z3>,
pub align: Int<'z3>,
pub element_ty: ElementTy<'tcx>,
pub kind: AllocKind<'z3>,
pub facts: AllocFacts<'z3, 'tcx>,
pub parent: Option<AllocId>,
}Expand description
A memory allocation: a stack local, a heap object (Box/Vec), or an
external raw-pointer placeholder.
The allocation is stored in a MemoryUnit at index AllocId.0 (an
AllocId is a monotonic counter that doubles as the vector index).
Fields§
§base: Int<'z3>Base address (fresh Z3 constant).
size: Int<'z3>Size in bytes (Z3 term, may be symbolic).
align: Int<'z3>Alignment in bytes (Z3 term, may be symbolic for a generic element type).
element_ty: ElementTy<'tcx>Type of the allocation’s contents (concrete Ty or symbolic Generic).
kind: AllocKind<'z3>The allocation shape (object vs slice vs external).
facts: AllocFacts<'z3, 'tcx>Cross-cutting per-allocation facts (dead/liveness/for_each), kept
apart from the shape metadata above.
parent: Option<AllocId>The allocation a sub-view was derived from: a slice view created by
s[i..j] / s.get(range), split_at / align_to / as_chunks, or
from_raw_parts. Each view is a fresh AllocId but a window onto the
same memory as its source, so root_alloc follows this edge to group
aliasing views. The address linkage back to the source lives in the
pointer term (parent_term + offset) and provenance offset, not in
base arithmetic.
Implementations§
Source§impl<'z3, 'tcx> Allocation<'z3, 'tcx>
impl<'z3, 'tcx> Allocation<'z3, 'tcx>
Sourcepub(crate) fn new(
base: Int<'z3>,
size: Int<'z3>,
align: Int<'z3>,
element_ty: Option<Ty<'tcx>>,
kind: AllocKind<'z3>,
) -> Self
pub(crate) fn new( base: Int<'z3>, size: Int<'z3>, align: Int<'z3>, element_ty: Option<Ty<'tcx>>, kind: AllocKind<'z3>, ) -> Self
Construct a fresh allocation with all live/dead/invariant flags in their initial state.
Sourcepub(crate) fn is_external(&self) -> bool
pub(crate) fn is_external(&self) -> bool
Whether this allocation models an external raw-pointer parameter.
Sourcepub(crate) fn slice_len(&self) -> Option<&Int<'z3>>
pub(crate) fn slice_len(&self) -> Option<&Int<'z3>>
The slice/array element count, if this allocation is slice data.
Invariant: size == len * sizeof(element_ty) is maintained by the
callers that call Self::set_slice_len (they compute size from the
same len and push the equality as a path condition); it is not
enforced here. slice_len_from_value falls back to size / elem_size
when the length was never materialized.
Sourcepub(crate) fn set_slice_len(&mut self, len: Int<'z3>)
pub(crate) fn set_slice_len(&mut self, len: Int<'z3>)
Mark this allocation as slice data with the given element count.
Callers must keep size == len * sizeof(element_ty) consistent.
Trait Implementations§
Source§impl<'z3, 'tcx> Clone for Allocation<'z3, 'tcx>
impl<'z3, 'tcx> Clone for Allocation<'z3, 'tcx>
Auto Trait Implementations§
impl<'z3, 'tcx> !DynSend for Allocation<'z3, 'tcx>
impl<'z3, 'tcx> !DynSync for Allocation<'z3, 'tcx>
impl<'z3, 'tcx> !RefUnwindSafe for Allocation<'z3, 'tcx>
impl<'z3, 'tcx> !Send for Allocation<'z3, 'tcx>
impl<'z3, 'tcx> !Sync for Allocation<'z3, 'tcx>
impl<'z3, 'tcx> !UnwindSafe for Allocation<'z3, 'tcx>
impl<'z3, 'tcx> Freeze for Allocation<'z3, 'tcx>
impl<'z3, 'tcx> Unpin for Allocation<'z3, 'tcx>
impl<'z3, 'tcx> UnsafeUnpin for Allocation<'z3, 'tcx>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more