@@ -12,13 +12,13 @@ The MIR-based region analysis consists of two major functions:
12
12
- ` replace_regions_in_mir ` , invoked first, has two jobs:
13
13
- First, it finds the set of regions that appear within the
14
14
signature of the function (e.g., ` 'a ` in `fn foo<'a>(&'a u32) {
15
- ... }`). These are called the "universal" or "free" regions -- in
15
+ ... }`). These are called the "universal" or "free" regions – in
16
16
particular, they are the regions that [ appear free] [ fvb ] in the
17
17
function body.
18
18
- Second, it replaces all the regions from the function body with
19
19
fresh inference variables. This is because (presently) those
20
20
regions are the results of lexical region inference and hence are
21
- not of much interest. The intention is that -- eventually -- they
21
+ not of much interest. The intention is that – eventually – they
22
22
will be "erased regions" (i.e., no information at all), since we
23
23
won't be doing lexical region inference at all.
24
24
- ` compute_regions ` , invoked second: this is given as argument the
@@ -40,11 +40,11 @@ The MIR-based region analysis consists of two major functions:
40
40
41
41
## Universal regions
42
42
43
- * to be written* -- explain the ` UniversalRegions ` type
43
+ * to be written* – explain the ` UniversalRegions ` type
44
44
45
45
## Region variables and constraints
46
46
47
- * to be written* -- describe the ` RegionInferenceContext ` and
47
+ * to be written* – describe the ` RegionInferenceContext ` and
48
48
the role of ` liveness_constraints ` vs other ` constraints ` , plus
49
49
50
50
## Closures
@@ -79,13 +79,13 @@ The kinds of region elements are as follows:
79
79
- Similarly, there is an element denoted ` end('static) ` corresponding
80
80
to the remainder of program execution after this function returns.
81
81
- There is an element ` !1 ` for each skolemized region ` !1 ` . This
82
- corresponds (intuitively) to some unknown set of other elements --
82
+ corresponds (intuitively) to some unknown set of other elements –
83
83
for details on skolemization, see the section
84
84
[ skolemization and universes] ( #skol ) .
85
85
86
86
## Causal tracking
87
87
88
- * to be written* -- describe how we can extend the values of a variable
88
+ * to be written* – describe how we can extend the values of a variable
89
89
with causal tracking etc
90
90
91
91
<a name =" skol " ></a >
@@ -133,7 +133,7 @@ bound in the supertype and **skolemizing** them: this means that we
133
133
replace them with
134
134
[ universally quantified] ( appendix/background.html#quantified )
135
135
representatives, written like ` !1 ` . We call these regions "skolemized
136
- regions" -- they represent, basically, "some unknown region".
136
+ regions" – they represent, basically, "some unknown region".
137
137
138
138
Once we've done that replacement, we have the following relation:
139
139
@@ -156,9 +156,9 @@ we swap the left and right here):
156
156
```
157
157
158
158
According to the basic subtyping rules for a reference, this will be
159
- true if ` '!1: 'static ` . That is -- if "some unknown region ` !1 ` " lives
160
- outlives ` 'static ` . Now, this * might* be true -- after all, ` '!1 `
161
- could be ` 'static ` -- but we don't * know* that it's true. So this
159
+ true if ` '!1: 'static ` . That is – if "some unknown region ` !1 ` " lives
160
+ outlives ` 'static ` . Now, this * might* be true – after all, ` '!1 `
161
+ could be ` 'static ` – but we don't * know* that it's true. So this
162
162
should yield up an error (eventually).
163
163
164
164
### What is a universe
@@ -238,16 +238,16 @@ not U1.
238
238
** Giving existential variables a universe.** Now that we have this
239
239
notion of universes, we can use it to extend our type-checker and
240
240
things to prevent illegal names from leaking out. The idea is that we
241
- give each inference (existential) variable -- whether it be a type or
242
- a lifetime -- a universe. That variable's value can then only
241
+ give each inference (existential) variable – whether it be a type or
242
+ a lifetime – a universe. That variable's value can then only
243
243
reference names visible from that universe. So for example is a
244
244
lifetime variable is created in U0, then it cannot be assigned a value
245
245
of ` !1 ` or ` !2 ` , because those names are not visible from the universe
246
246
U0.
247
247
248
248
** Representing universes with just a counter.** You might be surprised
249
249
to see that the compiler doesn't keep track of a full tree of
250
- universes. Instead, it just keeps a counter -- and, to determine if
250
+ universes. Instead, it just keeps a counter – and, to determine if
251
251
one universe can see another one, it just checks if the index is
252
252
greater. For example, U2 can see U0 because 2 >= 0. But U0 cannot see
253
253
U2, because 0 >= 2 is false.
@@ -323,12 +323,12 @@ Now there are two ways that could happen. First, if `U(V1)` can see
323
323
the universe ` x ` (i.e., ` x <= U(V1) ` ), then we can just add ` skol(x) `
324
324
to ` value(V1) ` and be done. But if not, then we have to approximate:
325
325
we may not know what set of elements ` skol(x) ` represents, but we
326
- should be able to compute some sort of ** upper bound** B for it --
326
+ should be able to compute some sort of ** upper bound** B for it –
327
327
some region B that outlives ` skol(x) ` . For now, we'll just use
328
- ` 'static ` for that (since it outlives everything) -- in the future, we
328
+ ` 'static ` for that (since it outlives everything) – in the future, we
329
329
can sometimes be smarter here (and in fact we have code for doing this
330
330
already in other contexts). Moreover, since ` 'static ` is in the root
331
- universe U0, we know that all variables can see it -- so basically if
331
+ universe U0, we know that all variables can see it – so basically if
332
332
we find that ` value(V2) ` contains ` skol(x) ` for some universe ` x `
333
333
that ` V1 ` can't see, then we force ` V1 ` to ` 'static ` .
334
334
@@ -398,8 +398,8 @@ outlives relationships are satisfied. Then we would go to the "check
398
398
universal regions" portion of the code, which would test that no
399
399
universal region grew too large.
400
400
401
- In this case, ` V1 ` * did* grow too large -- it is not known to outlive
402
- ` end('static) ` , nor any of the CFG -- so we would report an error.
401
+ In this case, ` V1 ` * did* grow too large – it is not known to outlive
402
+ ` end('static) ` , nor any of the CFG – so we would report an error.
403
403
404
404
## Another example
405
405
0 commit comments