Skip to content

Commit fa1f564

Browse files
committed
document the purpose of ScopeInstantiator
1 parent 40fc8ba commit fa1f564

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,13 @@ impl<'cx, 'bccx, 'gcx, 'tcx> TypeRelation<'cx, 'gcx, 'tcx>
468468
}
469469
}
470470

471+
/// When we encounter a binder like `for<..> fn(..)`, we actually have
472+
/// to walk the `fn` value to find all the values bound by the `for`
473+
/// (these are not explicitly present in the ty representation right
474+
/// now). This visitor handles that: it descends the type, tracking
475+
/// binder depth, and finds late-bound regions targeting the
476+
/// `for<..`>. For each of those, it creates an entry in
477+
/// `bound_region_scope`.
471478
struct ScopeInstantiator<'cx, 'gcx: 'cx + 'tcx, 'tcx: 'cx> {
472479
infcx: &'cx InferCtxt<'cx, 'gcx, 'tcx>,
473480
// The debruijn index of the scope we are instantiating.

0 commit comments

Comments
 (0)