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>
impl<'tcx> PlaceInfo<'tcx>
Sourcepub fn build<'a>(
tcx: TyCtxt<'tcx>,
def_id: DefId,
input: impl FlowistryInput<'tcx, 'a>,
) -> Self
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.
Sourcepub fn build_from_input_facts<'a>(
tcx: TyCtxt<'tcx>,
def_id: DefId,
input: impl FlowistryInput<'tcx, 'a>,
) -> Self
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.
pub fn body(&self) -> &'tcx Body<'tcx>
Sourcepub fn normalize(&self, place: Place<'tcx>) -> Place<'tcx>
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.
Sourcepub fn aliases(&self, place: Place<'tcx>) -> &PlaceSet<'tcx>
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
!
Sourcepub fn children(&self, place: Place<'tcx>) -> PlaceSet<'tcx>
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}
.
Sourcepub fn conflicts(&self, place: Place<'tcx>) -> &PlaceSet<'tcx>
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)}
Sourcepub fn reachable_values(
&self,
place: Place<'tcx>,
mutability: Mutability,
) -> &PlaceSet<'tcx>
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
).
Sourcepub fn all_args(
&self,
) -> impl Iterator<Item = (Place<'tcx>, LocationOrArgIndex)> + '_
pub fn all_args( &self, ) -> impl Iterator<Item = (Place<'tcx>, LocationOrArgIndex)> + '_
Returns all direct places reachable from arguments to the current body.
Sourcepub fn location_domain(&self) -> &Rc<LocationOrArgDomain>
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> 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
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