Skip to content

Commit c7c309d

Browse files
committed
clean up skolemiza in traits
1 parent 5a11c34 commit c7c309d

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

src/traits/associated-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ The key point is that, on success, unification can also give back to
154154
us a set of subgoals that still remain to be proven (it can also give
155155
back region constraints, but those are not relevant here).
156156

157-
Whenever unification encounters an (unskolemized!) associated type
157+
Whenever unification encounters an (un-placeholder!) associated type
158158
projection P being equated with some other type T, it always succeeds,
159159
but it produces a subgoal `ProjectionEq(P = T)` that is propagated
160160
back up. Thus it falls to the ordinary workings of the trait system

src/traits/caching.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ but *replay* its effects on the type variables.
1111
## An example
1212

1313
The high-level idea of how the cache works is that we first replace
14-
all unbound inference variables with skolemized versions. Therefore,
14+
all unbound inference variables with placeholder versions. Therefore,
1515
if we had a trait reference `usize : Foo<$t>`, where `$t` is an unbound
1616
inference variable, we might replace it with `usize : Foo<$0>`, where
17-
`$0` is a skolemized type. We would then look this up in the cache.
17+
`$0` is a placeholder type. We would then look this up in the cache.
1818

1919
If we found a hit, the hit would tell us the immediate next step to
2020
take in the selection process (e.g. apply impl #22, or apply where
@@ -37,7 +37,7 @@ we would [confirm] `ImplCandidate(22)`, which would (as a side-effect) unify
3737
[confirm]: ./resolution.html#confirmation
3838

3939
Now, at some later time, we might come along and see a `usize :
40-
Foo<$u>`. When skolemized, this would yield `usize : Foo<$0>`, just as
40+
Foo<$u>`. When placeholder, this would yield `usize : Foo<$0>`, just as
4141
before, and hence the cache lookup would succeed, yielding
4242
`ImplCandidate(22)`. We would confirm `ImplCandidate(22)` which would
4343
(as a side-effect) unify `$u` with `isize`.

src/traits/hrtb.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ bounds*. An example of such a bound is `for<'a> MyTrait<&'a isize>`.
55
Let's walk through how selection on higher-ranked trait references
66
works.
77

8-
## Basic matching and skolemization leaks
8+
## Basic matching and placeholder leaks
99

1010
Suppose we have a trait `Foo`:
1111

@@ -36,20 +36,20 @@ to the subtyping for higher-ranked types (which is described [here][hrsubtype]
3636
and also in a [paper by SPJ]. If you wish to understand higher-ranked
3737
subtyping, we recommend you read the paper). There are a few parts:
3838

39-
**TODO**: We should define _skolemize_.
39+
**TODO**: We should define _placeholder_.
4040

4141
1. _Skolemize_ the obligation.
42-
2. Match the impl against the skolemized obligation.
43-
3. Check for _skolemization leaks_.
42+
2. Match the impl against the placeholder obligation.
43+
3. Check for _placeholder leaks_.
4444

4545
[hrsubtype]: https://github.com/rust-lang/rust/tree/master/src/librustc/infer/higher_ranked/README.md
4646
[paper by SPJ]: http://research.microsoft.com/en-us/um/people/simonpj/papers/higher-rank/
4747

4848
So let's work through our example.
4949

5050
1. The first thing we would do is to
51-
skolemize the obligation, yielding `AnyInt : Foo<&'0 isize>` (here `'0`
52-
represents skolemized region #0). Note that we now have no quantifiers;
51+
placeholder the obligation, yielding `AnyInt : Foo<&'0 isize>` (here `'0`
52+
represents placeholder region #0). Note that we now have no quantifiers;
5353
in terms of the compiler type, this changes from a `ty::PolyTraitRef`
5454
to a `TraitRef`. We would then create the `TraitRef` from the impl,
5555
using fresh variables for it's bound regions (and thus getting
@@ -59,10 +59,10 @@ using fresh variables for it's bound regions (and thus getting
5959
we relate the two trait refs, yielding a graph with the constraint
6060
that `'0 == '$a`.
6161

62-
3. Finally, we check for skolemization "leaks" – a
63-
leak is basically any attempt to relate a skolemized region to another
64-
skolemized region, or to any region that pre-existed the impl match.
65-
The leak check is done by searching from the skolemized region to find
62+
3. Finally, we check for placeholder "leaks" – a
63+
leak is basically any attempt to relate a placeholder region to another
64+
placeholder region, or to any region that pre-existed the impl match.
65+
The leak check is done by searching from the placeholder region to find
6666
the set of regions that it is related to in any way. This is called
6767
the "taint" set. To pass the check, that set must consist *solely* of
6868
itself and region variables from the impl. If the taint set includes
@@ -78,7 +78,7 @@ impl Foo<&'static isize> for StaticInt;
7878

7979
We want the obligation `StaticInt : for<'a> Foo<&'a isize>` to be
8080
considered unsatisfied. The check begins just as before. `'a` is
81-
skolemized to `'0` and the impl trait reference is instantiated to
81+
placeholder to `'0` and the impl trait reference is instantiated to
8282
`Foo<&'static isize>`. When we relate those two, we get a constraint
8383
like `'static == '0`. This means that the taint set for `'0` is `{'0,
8484
'static}`, which fails the leak check.
@@ -111,16 +111,16 @@ Now let's say we have a obligation `Baz: for<'a> Foo<&'a isize>` and we match
111111
this impl. What obligation is generated as a result? We want to get
112112
`Baz: for<'a> Bar<&'a isize>`, but how does that happen?
113113

114-
After the matching, we are in a position where we have a skolemized
114+
After the matching, we are in a position where we have a placeholder
115115
substitution like `X => &'0 isize`. If we apply this substitution to the
116116
impl obligations, we get `F : Bar<&'0 isize>`. Obviously this is not
117-
directly usable because the skolemized region `'0` cannot leak out of
117+
directly usable because the placeholder region `'0` cannot leak out of
118118
our computation.
119119

120120
What we do is to create an inverse mapping from the taint set of `'0`
121121
back to the original bound region (`'a`, here) that `'0` resulted
122122
from. (This is done in `higher_ranked::plug_leaks`). We know that the
123-
leak check passed, so this taint set consists solely of the skolemized
123+
leak check passed, so this taint set consists solely of the placeholder
124124
region itself plus various intermediate region variables. We then walk
125125
the trait-reference and convert every region in that taint set back to
126126
a late-bound region, so in this case we'd wind up with

0 commit comments

Comments
 (0)