flowistry::mir::placeinfo

Struct PlaceInfo

Source
pub struct PlaceInfo<'tcx> {
    pub tcx: TyCtxt<'tcx>,
    pub body: &'tcx Body<'tcx>,
    pub def_id: DefId,
    /* private fields */
}
Expand description

Utilities for analyzing places: children, aliases, etc.

Fields§

§tcx: TyCtxt<'tcx>§body: &'tcx Body<'tcx>§def_id: DefId

Implementations§

Source§

impl<'tcx> PlaceInfo<'tcx>

Source

pub fn build<'a>( tcx: TyCtxt<'tcx>, def_id: DefId, input: impl FlowistryInput<'tcx, 'a>, ) -> Self

Computes all the metadata about places used within the infoflow analysis.

Source

pub fn build_from_input_facts<'a>( tcx: TyCtxt<'tcx>, def_id: DefId, input: impl FlowistryInput<'tcx, 'a>, ) -> Self

Computes all the metadata about places used within the infoflow analysis.

Source

pub fn body(&self) -> &'tcx Body<'tcx>

Source

pub fn normalize(&self, place: Place<'tcx>) -> Place<'tcx>

Normalizes a place via PlaceExt::normalize (cached).

See the PlaceExt documentation for details on how normalization works.

Source

pub fn aliases(&self, place: Place<'tcx>) -> &PlaceSet<'tcx>

Computes the aliases of a place (cached).

For example, if x = &y, then *x aliases y. Note that an alias is NOT guaranteed to be of the same type as place!

Source

pub fn children(&self, place: Place<'tcx>) -> PlaceSet<'tcx>

Returns all reachable fields of place without going through references.

For example, if x = (0, 1) then children(x) = {x, x.0, x.1}.

Source

pub fn conflicts(&self, place: Place<'tcx>) -> &PlaceSet<'tcx>

Returns all places that directly conflict with place, i.e. that a mutation to place would also be a mutation to the conflicting place.

For example, if x = ((0, 1), 2) then conflicts(x.0) = {x, x.0, x.0.0, x.0.1}, but not x.1.

For indirect places, this function follows conflicting parents up until a reference point. So if x = (0, &(box 1, 2)) then conflicts(((x.1).0)) = {((x.1).0), *(x.1).0, *(x.1)}

Source

pub fn reachable_values( &self, place: Place<'tcx>, mutability: Mutability, ) -> &PlaceSet<'tcx>

Returns all direct places that are reachable from place and can be used at the provided level of [Mutability] (cached).

For example, if x = 0 and y = (0, &x), then reachable_values(y, Mutability::Not) is {y, x}. With Mutability::Mut, then the output is {y} (no x).

Source

pub fn all_args( &self, ) -> impl Iterator<Item = (Place<'tcx>, LocationOrArgIndex)> + '_

Returns all direct places reachable from arguments to the current body.

Source

pub fn location_domain(&self) -> &Rc<LocationOrArgDomain>

Returns the LocationOrArgDomain for the current body.

Auto Trait Implementations§

§

impl<'tcx> !Freeze for PlaceInfo<'tcx>

§

impl<'tcx> !RefUnwindSafe for PlaceInfo<'tcx>

§

impl<'tcx> !Send for PlaceInfo<'tcx>

§

impl<'tcx> !Sync for PlaceInfo<'tcx>

§

impl<'tcx> Unpin for PlaceInfo<'tcx>

§

impl<'tcx> !UnwindSafe for PlaceInfo<'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
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
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.