]> git.lizzy.rs Git - rust.git/commitdiff
document the purpose of `ScopeInstantiator`
authorNiko Matsakis <niko@alum.mit.edu>
Tue, 28 Aug 2018 18:25:09 +0000 (14:25 -0400)
committerNiko Matsakis <niko@alum.mit.edu>
Sun, 9 Sep 2018 18:14:41 +0000 (14:14 -0400)
src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs

index 8ffce9c94926fa5437217fb2e578396c6f253c79..982ae560c8b1d1f8ae73cf7c319ee647e17fbfa9 100644 (file)
@@ -468,6 +468,13 @@ fn binders<T>(
     }
 }
 
+/// When we encounter a binder like `for<..> fn(..)`, we actually have
+/// to walk the `fn` value to find all the values bound by the `for`
+/// (these are not explicitly present in the ty representation right
+/// now). This visitor handles that: it descends the type, tracking
+/// binder depth, and finds late-bound regions targeting the
+/// `for<..`>.  For each of those, it creates an entry in
+/// `bound_region_scope`.
 struct ScopeInstantiator<'cx, 'gcx: 'cx + 'tcx, 'tcx: 'cx> {
     infcx: &'cx InferCtxt<'cx, 'gcx, 'tcx>,
     // The debruijn index of the scope we are instantiating.