pub struct PointsToFacts {
pub body: BodyId,
pub interner: LocInterner,
/* private fields */
}Expand description
Per-body points-to result.
Owns the body-local LocInterner and a flat SsaValue → PointsToSet
table. The table is dense, one slot per SSA value, so lookups
are O(1).
Fields§
§body: BodyIdBody the facts were computed for; used as the disambiguator
inside crate::pointer::AbsLoc::Param / Alloc / SelfParam.
interner: LocInternerInterner for the super::domain::AbsLoc referenced by the
per-value points-to sets.
Implementations§
Source§impl PointsToFacts
impl PointsToFacts
Sourcepub fn empty(body: BodyId) -> Self
pub fn empty(body: BodyId) -> Self
Empty result, every value points to nothing. Used by callers that need a “no facts” placeholder when the analysis is disabled or the body could not be analysed.
Sourcepub fn pt(&self, v: SsaValue) -> &PointsToSet
pub fn pt(&self, v: SsaValue) -> &PointsToSet
Borrow the points-to set for v. Returns an empty set when
v is out of range (e.g. a value defined by an instruction
the analysis didn’t visit).
Sourcepub fn is_trivial(&self) -> bool
pub fn is_trivial(&self) -> bool
True when every value has an empty points-to set. Used as a fast-path skip in callers that only care about non-trivial aliasing.
Sourcepub fn proxy_hint(&self, v: SsaValue) -> PtrProxyHint
pub fn proxy_hint(&self, v: SsaValue) -> PtrProxyHint
Classify a value’s points-to set into a PtrProxyHint for
consumers that only care about the “is this a sub-field alias”
distinction. Returns PtrProxyHint::Other for empty sets,
Top, and any set containing a root location (AbsLoc::SelfParam
/ AbsLoc::Param / AbsLoc::Alloc). Returns
PtrProxyHint::FieldOnly iff every member is an
AbsLoc::Field.
Sourcepub fn name_proxy_hints(&self, body: &SsaBody) -> HashMap<String, PtrProxyHint>
pub fn name_proxy_hints(&self, body: &SsaBody) -> HashMap<String, PtrProxyHint>
Build a var_name → PtrProxyHint map by scanning the body’s
value defs for the latest definition of each named variable.
Names that resolve to no variable, or whose latest definition is
Other, are omitted, only FieldOnly entries appear.
Iterates over SsaBody::value_defs in reverse order so the
last (post-renaming) SSA definition for each name wins. Used by
the resource-lifecycle pass to look up pt(receiver_text) in
apply_call without re-walking the SSA body.
Trait Implementations§
Source§impl Clone for PointsToFacts
impl Clone for PointsToFacts
Source§fn clone(&self) -> PointsToFacts
fn clone(&self) -> PointsToFacts
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for PointsToFacts
impl RefUnwindSafe for PointsToFacts
impl Send for PointsToFacts
impl Sync for PointsToFacts
impl Unpin for PointsToFacts
impl UnsafeUnpin for PointsToFacts
impl UnwindSafe for PointsToFacts
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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