@@ -78,19 +78,19 @@ The kinds of region elements are as follows:
78
78
etc) control-flow graph.
79
79
- Similarly, there is an element denoted ` end('static) ` corresponding
80
80
to the remainder of program execution after this function returns.
81
- - There is an element ` !1 ` for each skolemized region ` !1 ` . This
81
+ - There is an element ` !1 ` for each placeholder region ` !1 ` . This
82
82
corresponds (intuitively) to some unknown set of other elements –
83
- for details on skolemization , see the section
84
- [ skolemization and universes] ( #skol ) .
83
+ for details on placeholder , see the section
84
+ [ placeholder and universes] ( #placeholder ) .
85
85
86
86
## Causal tracking
87
87
88
88
* to be written* – describe how we can extend the values of a variable
89
89
with causal tracking etc
90
90
91
- <a name =" skol " ></a >
91
+ <a name =" placeholder " ></a >
92
92
93
- ## Skolemization and universes
93
+ ## Placeholders and universes
94
94
95
95
(This section describes ongoing work that hasn't landed yet.)
96
96
@@ -117,7 +117,7 @@ for its argument, and `bar` wants to be given a function that that
117
117
accepts ** any** reference (so it can call it with something on its
118
118
stack, for example). But * how* do we reject it and * why* ?
119
119
120
- ### Subtyping and skolemization
120
+ ### Subtyping and Placeholder
121
121
122
122
When we type-check ` main ` , and in particular the call ` bar(foo) ` , we
123
123
are going to wind up with a subtyping relationship like this one:
@@ -129,10 +129,10 @@ the type of `foo` the type `bar` expects
129
129
```
130
130
131
131
We handle this sort of subtyping by taking the variables that are
132
- bound in the supertype and ** skolemizing ** them: this means that we
132
+ bound in the supertype and ** placeholder ** them: this means that we
133
133
replace them with
134
134
[ universally quantified] ( ../appendix/background.html#quantified )
135
- representatives, written like ` !1 ` . We call these regions "skolemized
135
+ representatives, written like ` !1 ` . We call these regions "placeholder
136
136
regions" – they represent, basically, "some unknown region".
137
137
138
138
Once we've done that replacement, we have the following relation:
@@ -163,7 +163,7 @@ should yield up an error (eventually).
163
163
164
164
### What is a universe
165
165
166
- In the previous section, we introduced the idea of a skolemized
166
+ In the previous section, we introduced the idea of a placeholder
167
167
region, and we denoted it ` !1 ` . We call this number ` 1 ` the ** universe
168
168
index** . The idea of a "universe" is that it is a set of names that
169
169
are in scope within some type or at some point. Universes are formed
@@ -198,7 +198,7 @@ fn bar<'a, T>(t: &'a T) {
198
198
```
199
199
200
200
Here, the name ` 'b ` is not part of the root universe. Instead, when we
201
- "enter" into this ` for<'b> ` (e.g., by skolemizing it), we will create
201
+ "enter" into this ` for<'b> ` (e.g., by placeholder it), we will create
202
202
a child universe of the root, let's call it U1:
203
203
204
204
``` text
@@ -274,25 +274,25 @@ Here, the only way for the two foralls to interact would be through X,
274
274
but neither Y nor Z are in scope when X is declared, so its value
275
275
cannot reference either of them.
276
276
277
- ### Universes and skolemized region elements
277
+ ### Universes and placeholder region elements
278
278
279
279
But where does that error come from? The way it happens is like this.
280
280
When we are constructing the region inference context, we can tell
281
- from the type inference context how many skolemized variables exist
281
+ from the type inference context how many placeholder variables exist
282
282
(the ` InferCtxt ` has an internal counter). For each of those, we
283
283
create a corresponding universal region variable ` !n ` and a "region
284
- element" ` skol (n)` . This corresponds to "some unknown set of other
285
- elements". The value of ` !n ` is ` {skol (n)} ` .
284
+ element" ` placeholder (n)` . This corresponds to "some unknown set of other
285
+ elements". The value of ` !n ` is ` {placeholder (n)} ` .
286
286
287
287
At the same time, we also give each existential variable a
288
288
** universe** (also taken from the ` InferCtxt ` ). This universe
289
- determines which skolemized elements may appear in its value: For
290
- example, a variable in universe U3 may name ` skol (1)` , ` skol (2)` , and
291
- ` skol (3)` , but not ` skol (4)` . Note that the universe of an inference
289
+ determines which placeholder elements may appear in its value: For
290
+ example, a variable in universe U3 may name ` placeholder (1)` , ` placeholder (2)` , and
291
+ ` placeholder (3)` , but not ` placeholder (4)` . Note that the universe of an inference
292
292
variable controls what region elements ** can** appear in its value; it
293
293
does not say region elements ** will** appear.
294
294
295
- ### Skolemization and outlives constraints
295
+ ### Placeholders and outlives constraints
296
296
297
297
In the region inference engine, outlives constraints have the form:
298
298
@@ -313,44 +313,44 @@ are present in `value(V2)` and we add those nodes to `value(V1)`. If
313
313
we reach a return point, we add in any ` end(X) ` elements. That part
314
314
remains unchanged.
315
315
316
- But then * after that* we want to iterate over the skolemized ` skol (x)`
316
+ But then * after that* we want to iterate over the placeholder ` placeholder (x)`
317
317
elements in V2 (each of those must be visible to ` U(V2) ` , but we
318
318
should be able to just assume that is true, we don't have to check
319
319
it). We have to ensure that ` value(V1) ` outlives each of those
320
- skolemized elements.
320
+ placeholder elements.
321
321
322
322
Now there are two ways that could happen. First, if ` U(V1) ` can see
323
- the universe ` x ` (i.e., ` x <= U(V1) ` ), then we can just add ` skol (x)`
323
+ the universe ` x ` (i.e., ` x <= U(V1) ` ), then we can just add ` placeholder (x)`
324
324
to ` value(V1) ` and be done. But if not, then we have to approximate:
325
- we may not know what set of elements ` skol (x)` represents, but we
325
+ we may not know what set of elements ` placeholder (x)` represents, but we
326
326
should be able to compute some sort of ** upper bound** B for it –
327
- some region B that outlives ` skol (x)` . For now, we'll just use
327
+ some region B that outlives ` placeholder (x)` . For now, we'll just use
328
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
331
universe U0, we know that all variables can see it – so basically if
332
- we find that ` value(V2) ` contains ` skol (x)` for some universe ` x `
332
+ we find that ` value(V2) ` contains ` placeholder (x)` for some universe ` x `
333
333
that ` V1 ` can't see, then we force ` V1 ` to ` 'static ` .
334
334
335
335
### Extending the "universal regions" check
336
336
337
337
After all constraints have been propagated, the NLL region inference
338
338
has one final check, where it goes over the values that wound up being
339
339
computed for each universal region and checks that they did not get
340
- 'too large'. In our case, we will go through each skolemized region
341
- and check that it contains * only* the ` skol (u)` element it is known to
340
+ 'too large'. In our case, we will go through each placeholder region
341
+ and check that it contains * only* the ` placeholder (u)` element it is known to
342
342
outlive. (Later, we might be able to know that there are relationships
343
- between two skolemized regions and take those into account, as we do
343
+ between two placeholder regions and take those into account, as we do
344
344
for universal regions from the fn signature.)
345
345
346
346
Put another way, the "universal regions" check can be considered to be
347
347
checking constraints like:
348
348
349
349
``` text
350
- {skol (1)}: V1
350
+ {placeholder (1)}: V1
351
351
```
352
352
353
- where ` {skol (1)} ` is like a constant set, and V1 is the variable we
353
+ where ` {placeholder (1)} ` is like a constant set, and V1 is the variable we
354
354
made to represent the ` !1 ` region.
355
355
356
356
## Back to our example
@@ -365,7 +365,7 @@ fn(&'static u32) <: fn(&'!1 u32) @ P // this point P is not imp't here
365
365
The region inference engine will create a region element domain like this:
366
366
367
367
``` text
368
- { CFG; end('static); skol (1) }
368
+ { CFG; end('static); placeholder (1) }
369
369
--- ------------ ------- from the universe `!1`
370
370
| 'static is always in scope
371
371
all points in the CFG; not especially relevant here
@@ -377,7 +377,7 @@ will have initial values like so:
377
377
378
378
``` text
379
379
Vs = { CFG; end('static) } // it is in U0, so can't name anything else
380
- V1 = { skol (1) }
380
+ V1 = { placeholder (1) }
381
381
```
382
382
383
383
From the subtyping constraint above, we would have an outlives constraint like
@@ -390,7 +390,7 @@ To process this, we would grow the value of V1 to include all of Vs:
390
390
391
391
``` text
392
392
Vs = { CFG; end('static) }
393
- V1 = { CFG; end('static), skol (1) }
393
+ V1 = { CFG; end('static), placeholder (1) }
394
394
```
395
395
396
396
At that point, constraint propagation is complete, because all the
@@ -411,7 +411,7 @@ for<'a> fn(&'a u32, &'a u32)
411
411
for<'b, 'c> fn(&'b u32, &'c u32)
412
412
```
413
413
414
- Here we would skolemize the supertype, as before, yielding:
414
+ Here we would placeholer the supertype, as before, yielding:
415
415
416
416
``` text
417
417
for<'a> fn(&'a u32, &'a u32)
@@ -476,7 +476,7 @@ an error. That's good: the problem is that we've gone from a fn that promises
476
476
to return one of its two arguments, to a fn that is promising to return the
477
477
first one. That is unsound. Let's see how it plays out.
478
478
479
- First, we skolemize the supertype:
479
+ First, we placeholder the supertype:
480
480
481
481
``` text
482
482
for<'a> fn(&'a u32, &'a u32) -> &'a u32
@@ -512,26 +512,26 @@ V3: V1
512
512
Those variables will have these initial values:
513
513
514
514
``` text
515
- V1 in U1 = {skol (1)}
516
- V2 in U2 = {skol (2)}
515
+ V1 in U1 = {placeholder (1)}
516
+ V2 in U2 = {placeholder (2)}
517
517
V3 in U2 = {}
518
518
```
519
519
520
- Now because of the ` V3: V1 ` constraint, we have to add ` skol (1)` into ` V3 ` (and
520
+ Now because of the ` V3: V1 ` constraint, we have to add ` placeholder (1)` into ` V3 ` (and
521
521
indeed it is visible from ` V3 ` ), so we get:
522
522
523
523
``` text
524
- V3 in U2 = {skol (1)}
524
+ V3 in U2 = {placeholder (1)}
525
525
```
526
526
527
527
then we have this constraint ` V2: V3 ` , so we wind up having to enlarge
528
- ` V2 ` to include ` skol (1)` (which it can also see):
528
+ ` V2 ` to include ` placeholder (1)` (which it can also see):
529
529
530
530
``` text
531
- V2 in U2 = {skol (1), skol (2)}
531
+ V2 in U2 = {placeholder (1), placeholder (2)}
532
532
```
533
533
534
534
Now constraint propagation is done, but when we check the outlives
535
- relationships, we find that ` V2 ` includes this new element ` skol (1)` ,
535
+ relationships, we find that ` V2 ` includes this new element ` placeholder (1)` ,
536
536
so we report an error.
537
537
0 commit comments