about summary refs log tree commit diff
path: root/compiler/rustc_borrowck/src/dataflow.rs
diff options
context:
space:
mode:
authorRémy Rakic <remy.rakic+github@gmail.com>2023-06-30 12:21:50 +0000
committerRémy Rakic <remy.rakic+github@gmail.com>2023-10-04 16:16:12 +0000
commita946fabd48791a769abfa56e2c38f403ac2277fa (patch)
tree423121fa4745936d514e6bad89eaf58b23e650ca /compiler/rustc_borrowck/src/dataflow.rs
parent43cdf39d89a1efdc5f386c9a11d3160f12891207 (diff)
downloadrust-a946fabd48791a769abfa56e2c38f403ac2277fa.tar.gz
rust-a946fabd48791a769abfa56e2c38f403ac2277fa.zip
document Borrows dataflow analysis
Diffstat (limited to 'compiler/rustc_borrowck/src/dataflow.rs')
-rw-r--r--compiler/rustc_borrowck/src/dataflow.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_borrowck/src/dataflow.rs b/compiler/rustc_borrowck/src/dataflow.rs
index 4d2f983603a..031dbe299d1 100644
--- a/compiler/rustc_borrowck/src/dataflow.rs
+++ b/compiler/rustc_borrowck/src/dataflow.rs
@@ -333,6 +333,13 @@ impl<'tcx> rustc_mir_dataflow::AnalysisDomain<'tcx> for Borrows<'_, 'tcx> {
     }
 }
 
+/// Forward dataflow computation of the set of borrows that are in scope at a particular location.
+/// - we gen the introduced loans
+/// - we kill loans on locals going out of (regular) scope
+/// - we kill the loans going out of their region's NLL scope: in NLL terms, the frontier where a
+///   region stops containing the CFG points reachable from the issuing location.
+/// - we also kill loans of conflicting places when overwriting a shared path: e.g. borrows of
+///   `a.b.c` when `a` is overwritten.
 impl<'tcx> rustc_mir_dataflow::GenKillAnalysis<'tcx> for Borrows<'_, 'tcx> {
     type Idx = BorrowIndex;