struct PointsToAnalysis<'a> {
fn_sig: Option<&'a EarlyBinder<PolyFnSig>>,
map: &'a Map,
}Expand description
This implement a points to analysis for mutable references over a [FlatSet]. The analysis is
a may analysis. If you want to know if a reference definitively points to a location you have to
combine it with the result of a definitely initialized analysis. See module level documentation
for more details.
Fields§
§fn_sig: Option<&'a EarlyBinder<PolyFnSig>>§map: &'a MapImplementations§
Source§impl<'a> PointsToAnalysis<'a>
impl<'a> PointsToAnalysis<'a>
fn new(map: &'a Map, fn_sig: Option<&'a EarlyBinder<PolyFnSig>>) -> Self
fn handle_statement(&self, statement: &Statement<'_>, state: &mut State)
fn handle_assign( &self, target: Place<'_>, rvalue: &Rvalue<'_>, state: &mut State, )
Sourcefn handle_ref(&self, place: &Place<'_>, state: &State) -> FlatSet<Path>
fn handle_ref(&self, place: &Place<'_>, state: &State) -> FlatSet<Path>
This mirrors the way PlacesTree::lookup_inner walks a place: a dereference moves the root
of the path to whatever the pointer points to, and fields are accumulated onto it.
fn handle_operand(&self, operand: &Operand<'_>) -> Option<PlaceIndex>
Sourcefn handle_terminator<'tcx>(
&self,
terminator: &Terminator<'tcx>,
state: &mut State,
)
fn handle_terminator<'tcx>( &self, terminator: &Terminator<'tcx>, state: &mut State, )
The effect of a successful function call return should not be
applied here, see [Analysis::apply_primary_terminator_effect].
fn handle_call_return( &self, return_places: CallReturnPlaces<'_, '_>, state: &mut State, )
Trait Implementations§
Source§impl<'tcx> Analysis<'tcx> for PointsToAnalysis<'_>
impl<'tcx> Analysis<'tcx> for PointsToAnalysis<'_>
Source§const NAME: &'static str = "PointsToAnalysis"
const NAME: &'static str = "PointsToAnalysis"
A descriptive name for this analysis. Used only for debugging. Read more
Source§fn bottom_value(&self, _: &Body<'tcx>) -> Self::Domain
fn bottom_value(&self, _: &Body<'tcx>) -> Self::Domain
Returns the initial value of the dataflow state upon entry to each basic block.
Source§fn initialize_start_block(&self, body: &Body<'tcx>, state: &mut Self::Domain)
fn initialize_start_block(&self, body: &Body<'tcx>, state: &mut Self::Domain)
Mutates the initial value of the dataflow state upon entry to the
START_BLOCK. Read moreSource§fn apply_primary_statement_effect(
&self,
state: &mut Self::Domain,
statement: &Statement<'tcx>,
_location: Location,
)
fn apply_primary_statement_effect( &self, state: &mut Self::Domain, statement: &Statement<'tcx>, _location: Location, )
Updates the current dataflow state with the effect of evaluating a statement.
Source§fn apply_primary_terminator_effect(
&self,
state: &mut Self::Domain,
terminator: &Terminator<'tcx>,
_location: Location,
)
fn apply_primary_terminator_effect( &self, state: &mut Self::Domain, terminator: &Terminator<'tcx>, _location: Location, )
Updates the current dataflow state with the effect of evaluating a terminator. Read more
Source§fn apply_call_return_effect(
&self,
state: &mut Self::Domain,
_block: BasicBlock,
return_places: CallReturnPlaces<'_, 'tcx>,
)
fn apply_call_return_effect( &self, state: &mut Self::Domain, _block: BasicBlock, return_places: CallReturnPlaces<'_, 'tcx>, )
Updates the current dataflow state with the effect of a successful return from a
Call
terminator. Read more§type SwitchIntData = !
type SwitchIntData = !
Auxiliary data used for analyzing
SwitchInt terminators, if necessary.§fn apply_effect<'mir>(
&self,
state: &mut Self::Domain,
block: BasicBlock,
block_data: &'mir BasicBlockData<'tcx>,
idx: EffectIndex,
)
fn apply_effect<'mir>( &self, state: &mut Self::Domain, block: BasicBlock, block_data: &'mir BasicBlockData<'tcx>, idx: EffectIndex, )
Given an
EffectIndex, calls the appropriate apply_* method in the
{early,primary} x {statement,terminator} space. Read more§fn apply_early_statement_effect(
&self,
_state: &mut Self::Domain,
_statement: &Statement<'tcx>,
_location: Location,
)
fn apply_early_statement_effect( &self, _state: &mut Self::Domain, _statement: &Statement<'tcx>, _location: Location, )
Updates the current dataflow state with an “early” effect, i.e. one
that occurs immediately before the given statement. Read more
§fn apply_early_terminator_effect(
&self,
_state: &mut Self::Domain,
_terminator: &Terminator<'tcx>,
_location: Location,
)
fn apply_early_terminator_effect( &self, _state: &mut Self::Domain, _terminator: &Terminator<'tcx>, _location: Location, )
Updates the current dataflow state with an effect that occurs immediately before the
given terminator. Read more
§fn get_terminator_edges<'mir>(
&self,
_state: &Self::Domain,
terminator: &'mir Terminator<'tcx>,
_location: Location,
) -> TerminatorEdges<'mir, 'tcx>
fn get_terminator_edges<'mir>( &self, _state: &Self::Domain, terminator: &'mir Terminator<'tcx>, _location: Location, ) -> TerminatorEdges<'mir, 'tcx>
Gets the terminator edges. Used by forward analyses only. Called before
apply_primary_terminator_effect is applied; this might seem strange but in practice
MaybeInitializedPlaces needs that ordering and other analyses work with either ordering.§fn get_switch_int_data(
&self,
_block: BasicBlock,
_targets: &SwitchTargets,
_discr: &Operand<'tcx>,
) -> Option<Self::SwitchIntData>
fn get_switch_int_data( &self, _block: BasicBlock, _targets: &SwitchTargets, _discr: &Operand<'tcx>, ) -> Option<Self::SwitchIntData>
Used to update the current dataflow state with the effect of taking a particular branch in
a
SwitchInt terminator. Read more§fn apply_switch_int_edge_effect(
&self,
_state: &mut Self::Domain,
_data: &Self::SwitchIntData,
_target_idx: SwitchTargetIndex,
)
fn apply_switch_int_edge_effect( &self, _state: &mut Self::Domain, _data: &Self::SwitchIntData, _target_idx: SwitchTargetIndex, )
See comments on
get_switch_int_data.Source§impl DebugWithContext<PointsToAnalysis<'_>> for State
This is used to visualize the dataflow analysis.
impl DebugWithContext<PointsToAnalysis<'_>> for State
This is used to visualize the dataflow analysis.
fn fmt_with(&self, ctxt: &PointsToAnalysis<'_>, f: &mut Formatter<'_>) -> Result
Source§fn fmt_diff_with(
&self,
old: &Self,
ctxt: &PointsToAnalysis<'_>,
f: &mut Formatter<'_>,
) -> Result
fn fmt_diff_with( &self, old: &Self, ctxt: &PointsToAnalysis<'_>, f: &mut Formatter<'_>, ) -> Result
Source§impl<'a, 'tcx> ResultsVisitor<'tcx, PointsToAnalysis<'a>> for CollectPointerToBorrows<'_>
impl<'a, 'tcx> ResultsVisitor<'tcx, PointsToAnalysis<'a>> for CollectPointerToBorrows<'_>
Source§fn visit_after_primary_statement_effect(
&mut self,
state: &State,
_statement: &Statement<'tcx>,
location: Location,
)
fn visit_after_primary_statement_effect( &mut self, state: &State, _statement: &Statement<'tcx>, location: Location, )
Called after the “primary” effect of the given statement is applied to
state.Source§fn visit_after_primary_terminator_effect(
&mut self,
_state: &State,
terminator: &Terminator<'tcx>,
location: Location,
)
fn visit_after_primary_terminator_effect( &mut self, _state: &State, terminator: &Terminator<'tcx>, location: Location, )
Called after the “primary” effect of the given terminator is applied to
state. Read more§fn visit_after_early_statement_effect(
&mut self,
_state: &<A as Analysis<'tcx>>::Domain,
_statement: &Statement<'tcx>,
_location: Location,
)
fn visit_after_early_statement_effect( &mut self, _state: &<A as Analysis<'tcx>>::Domain, _statement: &Statement<'tcx>, _location: Location, )
Called after the “early” effect of the given statement is applied to
state.§fn visit_after_early_terminator_effect(
&mut self,
_state: &<A as Analysis<'tcx>>::Domain,
_terminator: &Terminator<'tcx>,
_location: Location,
)
fn visit_after_early_terminator_effect( &mut self, _state: &<A as Analysis<'tcx>>::Domain, _terminator: &Terminator<'tcx>, _location: Location, )
Called after the “early” effect of the given terminator is applied to
state.Auto Trait Implementations§
impl<'a> DynSend for PointsToAnalysis<'a>
impl<'a> DynSync for PointsToAnalysis<'a>
impl<'a> Freeze for PointsToAnalysis<'a>
impl<'a> RefUnwindSafe for PointsToAnalysis<'a>
impl<'a> Send for PointsToAnalysis<'a>
impl<'a> Sync for PointsToAnalysis<'a>
impl<'a> Unpin for PointsToAnalysis<'a>
impl<'a> UnsafeUnpin for PointsToAnalysis<'a>
impl<'a> UnwindSafe for PointsToAnalysis<'a>
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
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
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 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> ⓘ
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