Skip to content

Commit 5abacd3

Browse files
committed
add comment clarifying what edges are needed
1 parent 7f8d245 commit 5abacd3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/librustc_typeck/check/coercion.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,14 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
278278
// want to use that target type region (`'b`) because --
279279
// for the program to type-check -- it must be the
280280
// smaller of the two.
281+
// - One fine point. It may be surprising that we can
282+
// use `'b` without relating `'a` and `'b`. The reason
283+
// that this is ok is that what we produce is
284+
// effectively a `&'b *x` expression (if you could
285+
// annotate the region of a borrow), and regionck has
286+
// code that adds edges from the region of a borrow
287+
// (`'b`, here) into the regions in the borrowed
288+
// expression (`*x`, here). (Search for "link".)
281289
// - if in lub mode, things can get fairly complicated. The
282290
// easiest thing is just to make a fresh
283291
// region variable [4], which effectively means we defer

0 commit comments

Comments
 (0)