Skip to content

Commit a946fab

Browse files
committed
document Borrows dataflow analysis
1 parent 43cdf39 commit a946fab

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

compiler/rustc_borrowck/src/dataflow.rs

+7
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,13 @@ impl<'tcx> rustc_mir_dataflow::AnalysisDomain<'tcx> for Borrows<'_, 'tcx> {
333333
}
334334
}
335335

336+
/// Forward dataflow computation of the set of borrows that are in scope at a particular location.
337+
/// - we gen the introduced loans
338+
/// - we kill loans on locals going out of (regular) scope
339+
/// - we kill the loans going out of their region's NLL scope: in NLL terms, the frontier where a
340+
/// region stops containing the CFG points reachable from the issuing location.
341+
/// - we also kill loans of conflicting places when overwriting a shared path: e.g. borrows of
342+
/// `a.b.c` when `a` is overwritten.
336343
impl<'tcx> rustc_mir_dataflow::GenKillAnalysis<'tcx> for Borrows<'_, 'tcx> {
337344
type Idx = BorrowIndex;
338345

0 commit comments

Comments
 (0)