Skip to main content

MemInfo

Struct MemInfo 

Source
pub struct MemInfo {
    pub size: u64,
    pub align: u32,
    pub order: MemOrder,
    pub tbaa: Option<Meta>,
    pub owns: u32,
    pub restrict: Restrict,
}
Expand description

What an access does beyond naming an address.

Fields§

§size: u64

How many bytes the access covers, for the ones whose size is not their result type.

A load takes its size from the type it produces. An alloca and a memset do not, and this is where theirs is.

§align: u32

The alignment the access is known to have, in bytes.

§order: MemOrder

How strongly it is ordered, with MemOrder::NotAtomic for an ordinary access.

§tbaa: Option<Meta>

The type-based aliasing node, if the front end knew one.

§owns: u32

How many bytes of its record this access owns, counting the padding after it.

Zero for an access that is not a member of a record, and zero when the front end was not asked to work it out. What it is for is the init plane of spec/safe-memory/09-type-init-and-races.md section 9.3: under -fsafety-init=nopadding a store through a member records the padding after the member as written too, so that a record filled a member at a time comes out whole and the ordinary reads of it, which are a memcmp or a hash or a write of the record, are not refused.

Only the init plane reads it. A bounds check over these bytes would be asking about bytes the access does not touch, and a type plane write over them would be saying the padding holds a value of the member’s type, which it does not.

§restrict: Restrict

Which restrict scope the access is in and which pointer it went through.

Trait Implementations§

Source§

impl Clone for MemInfo

Source§

fn clone(&self) -> MemInfo

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 Copy for MemInfo

Source§

impl Debug for MemInfo

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for MemInfo

Source§

impl PartialEq for MemInfo

Source§

fn eq(&self, other: &MemInfo) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for MemInfo

Auto Trait Implementations§

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