Skip to content

Commit 8aaedcc

Browse files
committed
---
yaml --- r: 196012 b: refs/heads/beta c: f15813d h: refs/heads/master v: v3
1 parent 6183e6e commit 8aaedcc

File tree

2 files changed

+31
-31
lines changed

2 files changed

+31
-31
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2929
refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3030
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3131
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
32-
refs/heads/beta: ea5138eba0110070a59754c6eb1b876dd031ca64
32+
refs/heads/beta: f15813d086605775514210762ccfd61e21c25599
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3535
refs/heads/tmp: 9de34a84bb300bab1bf0227f577331620cd60511

branches/beta/src/librustc/middle/infer/region_inference/README.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -274,36 +274,36 @@ closure:
274274
types of all its upvars must outlive `'r`.
275275
2. Parameters must outlive the region of any fn that they are passed to.
276276

277-
Therefore, we can -- sort of -- assume that when we are asked to
278-
compare a region `'a` from a closure with a region `'b` from the fn
279-
that encloses it, in fact `'b` is the larger region. And that is
280-
precisely what we do: when building the region hierarchy, each region
281-
lives in its own distinct subtree, but if we are asked to compute the
282-
`LUB(r1, r2)` of two regions, and those regions are in disjoint
283-
subtrees, we compare the lexical nesting of the two regions.
284-
285-
*Ideas for improving the situation:* The correct argument here is
286-
subtle and a bit hand-wavy. The ideal, as stated earlier, would be to
287-
model things in such a way that it corresponds more closely to the
288-
desugared code. The best approach for doing this is a bit unclear: it
289-
may in fact be possible to *actually* desugar before we start, but I
290-
don't think so. The main option that I've been thinking through is
291-
imposing a "view shift" as we enter the fn body, so that regions
292-
appearing in the types of fn parameters and upvars are translated from
293-
being regions in the outer fn into free region parameters, just as
294-
they would be if we applied the desugaring. The challenge here is that
295-
type inference may not have fully run, so the types may not be fully
296-
known: we could probably do this translation lazilly, as type
297-
variables are instantiated. We would also have to apply a kind of
298-
inverse translation to the return value. This would be a good idea
299-
anyway, as right now it is possible for free regions instantiated
300-
within the closure to leak into the parent: this currently leads to
301-
type errors, since those regions cannot outlive any expressions within
302-
the parent hierarchy. Much like the current handling of closures,
303-
there are no known cases where this leads to a type-checking accepting
304-
incorrect code (though it sometimes rejects what might be considered
305-
correct code; see rust-lang/rust#22557), but it still doesn't feel
306-
like the right approach.
277+
Therefore, we can -- sort of -- assume that any region from an
278+
enclosing fns is larger than any region from one of its enclosed
279+
fn. And that is precisely what we do: when building the region
280+
hierarchy, each region lives in its own distinct subtree, but if we
281+
are asked to compute the `LUB(r1, r2)` of two regions, and those
282+
regions are in disjoint subtrees, we compare the lexical nesting of
283+
the two regions.
284+
285+
*Ideas for improving the situation:* (FIXME #3696) The correctness
286+
argument here is subtle and a bit hand-wavy. The ideal, as stated
287+
earlier, would be to model things in such a way that it corresponds
288+
more closely to the desugared code. The best approach for doing this
289+
is a bit unclear: it may in fact be possible to *actually* desugar
290+
before we start, but I don't think so. The main option that I've been
291+
thinking through is imposing a "view shift" as we enter the fn body,
292+
so that regions appearing in the types of fn parameters and upvars are
293+
translated from being regions in the outer fn into free region
294+
parameters, just as they would be if we applied the desugaring. The
295+
challenge here is that type inference may not have fully run, so the
296+
types may not be fully known: we could probably do this translation
297+
lazilly, as type variables are instantiated. We would also have to
298+
apply a kind of inverse translation to the return value. This would be
299+
a good idea anyway, as right now it is possible for free regions
300+
instantiated within the closure to leak into the parent: this
301+
currently leads to type errors, since those regions cannot outlive any
302+
expressions within the parent hierarchy. Much like the current
303+
handling of closures, there are no known cases where this leads to a
304+
type-checking accepting incorrect code (though it sometimes rejects
305+
what might be considered correct code; see rust-lang/rust#22557), but
306+
it still doesn't feel like the right approach.
307307

308308
### Skolemization
309309

0 commit comments

Comments
 (0)