pub struct PlaceInfo<'a, 'tcx> { /* private fields */ }
Expand description
Utilities for analyzing places: children, aliases, etc.
Implementations§
source§impl<'a, 'tcx> PlaceInfo<'a, 'tcx>
impl<'a, 'tcx> PlaceInfo<'a, 'tcx>
sourcepub fn build(
tcx: TyCtxt<'tcx>,
def_id: DefId,
body_with_facts: &'a BodyWithBorrowckFacts<'tcx>
) -> Self
pub fn build( tcx: TyCtxt<'tcx>, def_id: DefId, body_with_facts: &'a BodyWithBorrowckFacts<'tcx> ) -> Self
Computes all the metadata about places used within the infoflow analysis.
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 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
.
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(
&'a self
) -> impl Iterator<Item = (Place<'tcx>, LocationOrArgIndex)> + 'a
pub fn all_args( &'a self ) -> impl Iterator<Item = (Place<'tcx>, LocationOrArgIndex)> + 'a
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.