Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit c68d710

Browse files
Support backward dataflow analyses
1 parent 032be94 commit c68d710

File tree

16 files changed

+1094
-661
lines changed

16 files changed

+1094
-661
lines changed

src/librustc_mir/borrow_check/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ crate struct MirBorrowckCtxt<'cx, 'tcx> {
518518
impl<'cx, 'tcx> dataflow::ResultsVisitor<'cx, 'tcx> for MirBorrowckCtxt<'cx, 'tcx> {
519519
type FlowState = Flows<'cx, 'tcx>;
520520

521-
fn visit_statement(
521+
fn visit_statement_before_primary_effect(
522522
&mut self,
523523
flow_state: &Flows<'cx, 'tcx>,
524524
stmt: &'cx Statement<'tcx>,
@@ -607,7 +607,7 @@ impl<'cx, 'tcx> dataflow::ResultsVisitor<'cx, 'tcx> for MirBorrowckCtxt<'cx, 'tc
607607
}
608608
}
609609

610-
fn visit_terminator(
610+
fn visit_terminator_before_primary_effect(
611611
&mut self,
612612
flow_state: &Flows<'cx, 'tcx>,
613613
term: &'cx Terminator<'tcx>,
@@ -701,7 +701,7 @@ impl<'cx, 'tcx> dataflow::ResultsVisitor<'cx, 'tcx> for MirBorrowckCtxt<'cx, 'tc
701701
}
702702
}
703703

704-
fn visit_terminator_exit(
704+
fn visit_terminator_after_primary_effect(
705705
&mut self,
706706
flow_state: &Flows<'cx, 'tcx>,
707707
term: &'cx Terminator<'tcx>,

src/librustc_mir/borrow_check/type_check/liveness/trace.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ impl LivenessContext<'_, '_, '_, 'tcx> {
408408
/// DROP of some local variable will have an effect -- note that
409409
/// drops, as they may unwind, are always terminators.
410410
fn initialized_at_terminator(&mut self, block: BasicBlock, mpi: MovePathIndex) -> bool {
411-
self.flow_inits.seek_before(self.body.terminator_loc(block));
411+
self.flow_inits.seek_before_primary_effect(self.body.terminator_loc(block));
412412
self.initialized_at_curr_loc(mpi)
413413
}
414414

@@ -418,7 +418,7 @@ impl LivenessContext<'_, '_, '_, 'tcx> {
418418
/// **Warning:** Does not account for the result of `Call`
419419
/// instructions.
420420
fn initialized_at_exit(&mut self, block: BasicBlock, mpi: MovePathIndex) -> bool {
421-
self.flow_inits.seek_after(self.body.terminator_loc(block));
421+
self.flow_inits.seek_after_primary_effect(self.body.terminator_loc(block));
422422
self.initialized_at_curr_loc(mpi)
423423
}
424424

src/librustc_mir/dataflow/framework/cursor.rs

Lines changed: 115 additions & 189 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)