about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2016-03-17 09:55:10 -0400
committerNiko Matsakis <niko@alum.mit.edu>2016-03-18 16:38:29 -0400
commit5abacd36f0149a9106d7ee04e97eadba4e523bb4 (patch)
tree1aeb097b28fed28f6df04a51e67a35380f4dfeb9
parent7f8d24590fa9b381eb38e2b007c88a446cf99479 (diff)
downloadrust-5abacd36f0149a9106d7ee04e97eadba4e523bb4.tar.gz
rust-5abacd36f0149a9106d7ee04e97eadba4e523bb4.zip
add comment clarifying what edges are needed
-rw-r--r--src/librustc_typeck/check/coercion.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs
index 1f7265bdb4d..a2c0b5b8934 100644
--- a/src/librustc_typeck/check/coercion.rs
+++ b/src/librustc_typeck/check/coercion.rs
@@ -278,6 +278,14 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
             //   want to use that target type region (`'b`) because --
             //   for the program to type-check -- it must be the
             //   smaller of the two.
+            //   - One fine point. It may be surprising that we can
+            //     use `'b` without relating `'a` and `'b`. The reason
+            //     that this is ok is that what we produce is
+            //     effectively a `&'b *x` expression (if you could
+            //     annotate the region of a borrow), and regionck has
+            //     code that adds edges from the region of a borrow
+            //     (`'b`, here) into the regions in the borrowed
+            //     expression (`*x`, here).  (Search for "link".)
             // - if in lub mode, things can get fairly complicated. The
             //   easiest thing is just to make a fresh
             //   region variable [4], which effectively means we defer