Skip to main content

Allocation

Struct Allocation 

Source
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>

Source

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.

Source

pub(crate) fn is_external(&self) -> bool

Whether this allocation models an external raw-pointer parameter.

Source

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.

Source

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>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'z3, 'tcx> Debug for Allocation<'z3, 'tcx>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V