Skip to content

Commit 006f547

Browse files
committed
Add more comments
1 parent 46760b4 commit 006f547

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

compiler/rustc_typeck/src/check/generator_interior/drop_ranges.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,15 @@ use crate::expr_use_visitor;
3434
/// record the parent expression, which is the point where the drop actually takes place.
3535
pub struct ExprUseDelegate<'tcx> {
3636
hir: Map<'tcx>,
37-
/// Maps a HirId to a set of HirIds that are dropped by that node.
37+
/// Records the point at which an expression or local variable is dropped.
38+
///
39+
/// The key is the hir-id of the expression, and the value is a set or hir-ids for variables
40+
/// or values that are consumed by that expression.
41+
///
42+
/// Note that this set excludes "partial drops" -- for example, a statement like `drop(x.y)` is
43+
/// not considered a drop of `x`.
3844
consumed_places: HirIdMap<HirIdSet>,
45+
/// A set of hir-ids of values or variables that are borrowed at some point within the body.
3946
borrowed_places: HirIdSet,
4047
}
4148

@@ -114,6 +121,8 @@ fn place_hir_id(place: &Place<'_>) -> Option<HirId> {
114121
pub struct DropRangeVisitor<'tcx> {
115122
hir: Map<'tcx>,
116123
/// Maps a HirId to a set of HirIds that are dropped by that node.
124+
///
125+
/// See also the more detailed comment on `ExprUseDelegate.consumed_places`.
117126
consumed_places: HirIdMap<HirIdSet>,
118127
borrowed_places: HirIdSet,
119128
drop_ranges: DropRanges,

0 commit comments

Comments
 (0)