From 5abacd36f0149a9106d7ee04e97eadba4e523bb4 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 17 Mar 2016 09:55:10 -0400 Subject: [PATCH] add comment clarifying what edges are needed --- src/librustc_typeck/check/coercion.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index 1f7265bdb4dd..a2c0b5b89342 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