Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up skolemization with placeholder #217

Merged
merged 8 commits into from
Oct 25, 2018
Merged

Conversation

csmoe
Copy link
Member

@csmoe csmoe commented Oct 24, 2018

Closes #211
r? @mark-i-m

Copy link
Member

@mark-i-m mark-i-m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Overall, looks good :)

One thing is that "placeholder" seems a bit weird when used as a verb. I would propose "placeholder-ify", "placeholdered", and "placeholdering". I left comments where I think we might want to change.

Also, I left a couple of nits/typos/minor comments.

src/appendix/glossary.md Outdated Show resolved Hide resolved
@@ -36,20 +36,20 @@ to the subtyping for higher-ranked types (which is described [here][hrsubtype]
and also in a [paper by SPJ]. If you wish to understand higher-ranked
subtyping, we recommend you read the paper). There are a few parts:

**TODO**: We should define _skolemize_.
**TODO**: We should define _placeholder_.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove this TODO and just link to the glossary?

@@ -78,7 +78,7 @@ impl Foo<&'static isize> for StaticInt;

We want the obligation `StaticInt : for<'a> Foo<&'a isize>` to be
considered unsatisfied. The check begins just as before. `'a` is
skolemized to `'0` and the impl trait reference is instantiated to
placeholder to `'0` and the impl trait reference is instantiated to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verb?

corresponds (intuitively) to some unknown set of other elements –
for details on skolemization, see the section
[skolemization and universes](#skol).
for details on placeholder, see the section
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for details on placeholder, see the section
for details on placeholders, see the section

for details on skolemization, see the section
[skolemization and universes](#skol).
for details on placeholder, see the section
[placeholder and universes](#placeholder).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[placeholder and universes](#placeholder).
[placeholders and universes](#placeholder).

@@ -198,7 +198,7 @@ fn bar<'a, T>(t: &'a T) {
```

Here, the name `'b` is not part of the root universe. Instead, when we
"enter" into this `for<'b>` (e.g., by skolemizing it), we will create
"enter" into this `for<'b>` (e.g., by placeholder it), we will create
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verb?

@@ -411,7 +411,7 @@ for<'a> fn(&'a u32, &'a u32)
for<'b, 'c> fn(&'b u32, &'c u32)
```

Here we would skolemize the supertype, as before, yielding:
Here we would placeholer the supertype, as before, yielding:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo:

Suggested change
Here we would placeholer the supertype, as before, yielding:
Here we would placeholder the supertype, as before, yielding:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verb?

@@ -476,7 +476,7 @@ an error. That's good: the problem is that we've gone from a fn that promises
to return one of its two arguments, to a fn that is promising to return the
first one. That is unsound. Let's see how it plays out.

First, we skolemize the supertype:
First, we placeholder the supertype:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verb?

src/traits/caching.md Outdated Show resolved Hide resolved

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

So let's work through our example.

1. The first thing we would do is to
skolemize the obligation, yielding `AnyInt : Foo<&'0 isize>` (here `'0`
represents skolemized region #0). Note that we now have no quantifiers;
placeholder the obligation, yielding `AnyInt : Foo<&'0 isize>` (here `'0`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verb?

@csmoe
Copy link
Member Author

csmoe commented Oct 25, 2018

@mark-i-m while re-review niko's PR, when talking about "placeholder-ify", the diff wrote "replace .. with placeholder" or "create/add placeholder". so I decide to follow his words, is this ok?
image

@csmoe csmoe force-pushed the placeholder branch 4 times, most recently from 2e1b236 to 659386f Compare October 25, 2018 03:15
Copy link
Member

@mark-i-m mark-i-m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent! Thanks @csmoe.

LGTM. I left a few nits/minor changes. I tried to use Github's new suggestions feature. Let me know how it works. After that, r=me 😄

src/borrow_check/region_inference.md Outdated Show resolved Hide resolved
src/borrow_check/region_inference.md Outdated Show resolved Hide resolved
src/traits/hrtb.md Outdated Show resolved Hide resolved
src/traits/caching.md Outdated Show resolved Hide resolved
@mark-i-m mark-i-m mentioned this pull request Oct 25, 2018
@csmoe
Copy link
Member Author

csmoe commented Oct 25, 2018

r? @mark-i-m it works 😄

@mark-i-m mark-i-m merged commit 4196710 into rust-lang:master Oct 25, 2018
@mark-i-m
Copy link
Member

Thanks @csmoe 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants