@@ -38,7 +38,7 @@ checks and effort.
3838
3939Whenever we introduce a borrowed pointer, for example as the result of
4040a borrow expression `let x = &data`, the lifetime of the pointer `x`
41- is always specified as a region inferencr variable. `regionck` has the
41+ is always specified as a region inference variable. `regionck` has the
4242job of adding constraints such that this inference variable is as
4343narrow as possible while still accommodating all uses (that is, every
4444dereference of the resulting pointer must be within the lifetime).
@@ -95,7 +95,7 @@ the following lattice:
9595 ty::ImmBorrow -> ty::UniqueImmBorrow -> ty::MutBorrow
9696
9797So, for example, if we see an assignment `x = 5` to an upvar `x`, we
98- will promote it's borrow kind to mutable borrow. If we see an `&mut x`
98+ will promote its borrow kind to mutable borrow. If we see an `&mut x`
9999we'll do the same. Naturally, this applies not just to the upvar, but
100100to everything owned by `x`, so the result is the same for something
101101like `x.f = 5` and so on (presuming `x` is not a borrowed pointer to a
@@ -107,7 +107,7 @@ The fact that we are inferring borrow kinds as we go results in a
107107semi-hacky interaction with mem-categorization. In particular,
108108mem-categorization will query the current borrow kind as it
109109categorizes, and we'll return the *current* value, but this may get
110- adjusted later. Therefore, in this module, we genreally ignore the
110+ adjusted later. Therefore, in this module, we generally ignore the
111111borrow kind (and derived mutabilities) that are returned from
112112mem-categorization, since they may be inaccurate. (Another option
113113would be to use a unification scheme, where instead of returning a
@@ -698,9 +698,9 @@ fn check_expr_fn_block(rcx: &mut Rcx,
698698 let inner_upvar_id = ty:: UpvarId {
699699 var_id : var_id,
700700 closure_expr_id : expr. id } ;
701- link_upvar_borrow_kind ( rcx,
702- inner_upvar_id,
703- outer_upvar_id) ;
701+ link_upvar_borrow_kind_for_nested_closures ( rcx,
702+ inner_upvar_id,
703+ outer_upvar_id) ;
704704 }
705705 _ => { }
706706 }
@@ -1114,7 +1114,7 @@ fn link_region_from_node_type(rcx: &mut Rcx,
11141114 /*!
11151115 * Like `link_region()`, except that the region is
11161116 * extracted from the type of `id`, which must be some
1117- * region-typed thing .
1117+ * reference (`&T`, `&str`, etc) .
11181118 */
11191119
11201120 let rptr_ty = rcx. resolve_node_type ( id) ;
@@ -1359,12 +1359,14 @@ fn adjust_upvar_borrow_kind_for_unique(rcx: &mut Rcx,
13591359 }
13601360}
13611361
1362- fn link_upvar_borrow_kind ( rcx : & mut Rcx ,
1363- inner_upvar_id : ty:: UpvarId ,
1364- outer_upvar_id : ty:: UpvarId ) {
1362+ fn link_upvar_borrow_kind_for_nested_closures ( rcx : & mut Rcx ,
1363+ inner_upvar_id : ty:: UpvarId ,
1364+ outer_upvar_id : ty:: UpvarId ) {
13651365 /*!
13661366 * Indicates that the borrow_kind of `outer_upvar_id` must
1367- * permit a reborrowing with the borrow_kind of `inner_upvar_id`
1367+ * permit a reborrowing with the borrow_kind of `inner_upvar_id`.
1368+ * This occurs in nested closures, see comment above at the call to
1369+ * this function.
13681370 */
13691371
13701372 debug ! ( "link_upvar_borrow_kind: inner_upvar_id={:?} outer_upvar_id={:?}" ,
0 commit comments