Skip to main content

ParamAttrs

Struct ParamAttrs 

Source
pub struct ParamAttrs {
    pub readonly: bool,
    pub nocapture: bool,
}
Expand description

Per-parameter pointer attributes, LLVM-style, inferred (or read from a C prototype) and consumed at call sites to relax the default “every pointer argument aliases everything and is written through by the callee” assumption.

The two bits are deliberately independent: readonly proves only that the callee does not write through the pointer during this call, which is enough to stop a call from clobbering the cells the argument reaches (see mem_forward’s call-kill). It does not prove the pointer is safe to reason about across the call: a captured pointer can be written through later, so frame-freshness reasoning additionally requires nocapture. Both bits default to false (fully conservative); an inference/extern pass sets them.

Fields§

§readonly: bool

The callee never writes through this pointer parameter (C *const semantics, one level deep: a store through a pointer loaded from the param does not clear this — only stores whose address is affine-derived from the param itself do).

§nocapture: bool

The callee does not retain this pointer beyond the call, except by returning it (capture-by-return does not clear this: the returned pointer is still tracked by the caller, so it is not an unbounded escape).

Implementations§

Source§

impl ParamAttrs

Source

pub const OPTIMISTIC: Self

The fully permissive attribute set (both bits): the optimistic starting point of the bottom-up inference fixpoint, whittled down as the body walk finds writes/captures/escapes.

Trait Implementations§

Source§

impl Clone for ParamAttrs

Source§

fn clone(&self) -> ParamAttrs

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 ParamAttrs

Source§

impl Debug for ParamAttrs

Source§

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

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

impl Default for ParamAttrs

Source§

fn default() -> ParamAttrs

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ParamAttrs

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for ParamAttrs

Source§

impl PartialEq for ParamAttrs

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl Serialize for ParamAttrs

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ParamAttrs

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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.