diff options
| author | Eric Holk <ericholk@microsoft.com> | 2021-12-06 11:08:00 -0800 |
|---|---|---|
| committer | Eric Holk <ericholk@microsoft.com> | 2022-01-18 14:25:27 -0800 |
| commit | 006f5471629e309c19084698e3bcb494ce60d808 (patch) | |
| tree | 651b19dc8322e5785cf9295c8c3c748847e7739c | |
| parent | 46760b4e673e95a4775775fe7da028a33d0f50ae (diff) | |
| download | rust-006f5471629e309c19084698e3bcb494ce60d808.tar.gz rust-006f5471629e309c19084698e3bcb494ce60d808.zip | |
Add more comments
| -rw-r--r-- | compiler/rustc_typeck/src/check/generator_interior/drop_ranges.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/compiler/rustc_typeck/src/check/generator_interior/drop_ranges.rs b/compiler/rustc_typeck/src/check/generator_interior/drop_ranges.rs index 708ce824780..eb95c4e0b64 100644 --- a/compiler/rustc_typeck/src/check/generator_interior/drop_ranges.rs +++ b/compiler/rustc_typeck/src/check/generator_interior/drop_ranges.rs @@ -34,8 +34,15 @@ use crate::expr_use_visitor; /// record the parent expression, which is the point where the drop actually takes place. pub struct ExprUseDelegate<'tcx> { hir: Map<'tcx>, - /// Maps a HirId to a set of HirIds that are dropped by that node. + /// Records the point at which an expression or local variable is dropped. + /// + /// The key is the hir-id of the expression, and the value is a set or hir-ids for variables + /// or values that are consumed by that expression. + /// + /// Note that this set excludes "partial drops" -- for example, a statement like `drop(x.y)` is + /// not considered a drop of `x`. consumed_places: HirIdMap<HirIdSet>, + /// A set of hir-ids of values or variables that are borrowed at some point within the body. borrowed_places: HirIdSet, } @@ -114,6 +121,8 @@ fn place_hir_id(place: &Place<'_>) -> Option<HirId> { pub struct DropRangeVisitor<'tcx> { hir: Map<'tcx>, /// Maps a HirId to a set of HirIds that are dropped by that node. + /// + /// See also the more detailed comment on `ExprUseDelegate.consumed_places`. consumed_places: HirIdMap<HirIdSet>, borrowed_places: HirIdSet, drop_ranges: DropRanges, |
