pub struct BackwardSlicer<'tcx> {
tcx: TyCtxt<'tcx>,
}Expand description
Entry point for backward path visiting.
Fields§
§tcx: TyCtxt<'tcx>Implementations§
Source§impl<'tcx> BackwardSlicer<'tcx>
impl<'tcx> BackwardSlicer<'tcx>
Sourcepub fn new(tcx: TyCtxt<'tcx>) -> Self
pub fn new(tcx: TyCtxt<'tcx>) -> Self
Create a backward visitor over the current compiler type context.
Sourcepub fn visit_path_tree(
&self,
tree: &PathTree,
target_block: usize,
checkpoint: &Checkpoint<'tcx>,
property: &Property<'tcx>,
) -> Vec<RelevantMirItems<'tcx>>
pub fn visit_path_tree( &self, tree: &PathTree, target_block: usize, checkpoint: &Checkpoint<'tcx>, property: &Property<'tcx>, ) -> Vec<RelevantMirItems<'tcx>>
Visit a path tree in post-order, sharing backward analysis across common prefixes. Merges child-relevance sets at branch nodes (the union is a sound over-approximation). Returns per-leaf results.
Callee parameter roots are bound at checkpoint nodes.
Sourcepub fn visit_path_tree_for_checkpoint(
&self,
tree: &PathTree,
target_block: usize,
caller: DefId,
checkpoint_loc: CheckpointLocation,
property: &Property<'tcx>,
) -> Vec<RelevantMirItems<'tcx>>
pub fn visit_path_tree_for_checkpoint( &self, tree: &PathTree, target_block: usize, caller: DefId, checkpoint_loc: CheckpointLocation, property: &Property<'tcx>, ) -> Vec<RelevantMirItems<'tcx>>
Like [visit_path_tree] but without callee-root binding (used for
struct-invariant checks where property places are already in the
caller’s local namespace).
Sourcefn visit_path_tree_impl(
&self,
tree: &PathTree,
target_block: usize,
caller: DefId,
checkpoint_block: BasicBlock,
bind_checkpoint: Option<&Checkpoint<'tcx>>,
property: &Property<'tcx>,
) -> Vec<RelevantMirItems<'tcx>>
fn visit_path_tree_impl( &self, tree: &PathTree, target_block: usize, caller: DefId, checkpoint_block: BasicBlock, bind_checkpoint: Option<&Checkpoint<'tcx>>, property: &Property<'tcx>, ) -> Vec<RelevantMirItems<'tcx>>
Internal: post-order recursion returning per-leaf
(block_path, backward_items).
Sourcefn build_leaf_items(
visitor: &Self,
node: &PathNode,
target_block: usize,
checkpoint_block: BasicBlock,
bind_checkpoint: Option<&Checkpoint<'tcx>>,
property: &Property<'tcx>,
body: &'tcx Body<'tcx>,
flow: &DataflowGraph,
keep_alloc: bool,
) -> Vec<(Vec<usize>, Vec<BackwardItem<'tcx>>, RelevantPlaces)>
fn build_leaf_items( visitor: &Self, node: &PathNode, target_block: usize, checkpoint_block: BasicBlock, bind_checkpoint: Option<&Checkpoint<'tcx>>, property: &Property<'tcx>, body: &'tcx Body<'tcx>, flow: &DataflowGraph, keep_alloc: bool, ) -> Vec<(Vec<usize>, Vec<BackwardItem<'tcx>>, RelevantPlaces)>
Post-order recursion: returns one (block_path, backward_items, relevant_before_block) per checkpoint leaf. Each leaf is independent
— no merging, no HashMap collision.
Sourcefn visit_statement(
&self,
block: BasicBlock,
statement_index: usize,
statement: &'tcx Statement<'tcx>,
flow: &DataflowGraph,
relevant: &mut RelevantPlaces,
items: &mut Vec<BackwardItem<'tcx>>,
keep_allocation_invalidations: bool,
)
fn visit_statement( &self, block: BasicBlock, statement_index: usize, statement: &'tcx Statement<'tcx>, flow: &DataflowGraph, relevant: &mut RelevantPlaces, items: &mut Vec<BackwardItem<'tcx>>, keep_allocation_invalidations: bool, )
Visit one MIR statement against the current relevance frontier.
Sourcefn visit_terminator(
&self,
block: BasicBlock,
terminator: &Terminator<'tcx>,
flow: &DataflowGraph,
body: &Body<'tcx>,
relevant: &mut RelevantPlaces,
items: &mut Vec<BackwardItem<'tcx>>,
keep_allocation_invalidations: bool,
)
fn visit_terminator( &self, block: BasicBlock, terminator: &Terminator<'tcx>, flow: &DataflowGraph, body: &Body<'tcx>, relevant: &mut RelevantPlaces, items: &mut Vec<BackwardItem<'tcx>>, keep_allocation_invalidations: bool, )
Visit one MIR terminator against the current relevance frontier.
Auto Trait Implementations§
impl<'tcx> Freeze for BackwardSlicer<'tcx>
impl<'tcx> !RefUnwindSafe for BackwardSlicer<'tcx>
impl<'tcx> !Send for BackwardSlicer<'tcx>
impl<'tcx> !Sync for BackwardSlicer<'tcx>
impl<'tcx> Unpin for BackwardSlicer<'tcx>
impl<'tcx> !UnwindSafe for BackwardSlicer<'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