Skip to content

Commit 5c5741b

Browse files
committed
add some comments
1 parent d6a98db commit 5c5741b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,14 @@ impl<'cx, 'bccx, 'gcx, 'tcx> TypeRelating<'cx, 'bccx, 'gcx, 'tcx> {
194194
scope
195195
}
196196

197+
/// When we encounter binders during the type traversal, we record
198+
/// the value to substitute for each of the things contained in
199+
/// that binder. (This will be either a universal placeholder or
200+
/// an existential inference variable.) Given the debruijn index
201+
/// `debruijn` (and name `br`) of some binder we have now
202+
/// encountered, this routine finds the value that we instantiated
203+
/// the region with; to do so, it indexes backwards into the list
204+
/// of ambient scopes `scopes`.
197205
fn lookup_bound_region(
198206
&self,
199207
debruijn: ty::DebruijnIndex,
@@ -211,6 +219,9 @@ impl<'cx, 'bccx, 'gcx, 'tcx> TypeRelating<'cx, 'bccx, 'gcx, 'tcx> {
211219
scope.map[br]
212220
}
213221

222+
/// If `r` is a bound region, find the scope in which it is bound
223+
/// (from `scopes`) and return the value that we instantiated it
224+
/// with. Otherwise just return `r`.
214225
fn replace_bound_region(
215226
&self,
216227
universal_regions: &UniversalRegions<'tcx>,
@@ -226,6 +237,8 @@ impl<'cx, 'bccx, 'gcx, 'tcx> TypeRelating<'cx, 'bccx, 'gcx, 'tcx> {
226237
}
227238
}
228239

240+
/// Push a new outlives requirement into our output set of
241+
/// constraints.
229242
fn push_outlives(&mut self, sup: RegionVid, sub: RegionVid) {
230243
debug!("push_outlives({:?}: {:?})", sup, sub);
231244

@@ -243,6 +256,9 @@ impl<'cx, 'bccx, 'gcx, 'tcx> TypeRelating<'cx, 'bccx, 'gcx, 'tcx> {
243256
}
244257
}
245258

259+
/// When we encounter a canonical variable `var` in the output,
260+
/// equate it with `kind`. If the variable has been previously
261+
/// equated, then equate it again.
246262
fn equate_var(
247263
&mut self,
248264
var: CanonicalVar,

0 commit comments

Comments
 (0)