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

adopt "placeholders" to represent universally quantified regions #54649

Merged
merged 10 commits into from
Oct 4, 2018

Conversation

nikomatsakis
Copy link
Contributor

This does a few preliminary refactorings that lay some groundwork for moving towards universe integration. Two things, primarily:

  • Rename from "skolemized" to "placeholder"
  • When instantiating for<'a, 'b, 'c>, just create one universe for all 3 regions, and distinguish them from one another using the BoundRegion.
    • This is more accurate, and I think that in general we'll be moving towards a model of separating "binder" (universe, debruijn index) from "index within binder" in a number of places.
    • In principle, it feels the current setup of making lots of universes could lead to us doing the wrong thing, but I've actually not been able to come up with an example where this is so.

r? @scalexm
cc @arielb1

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 28, 2018
@nikomatsakis
Copy link
Contributor Author

I'm mildly rethinking the question of whether to have multiple placeholders per universe. It annoys me that I can't think of an example where it would matter, though I thought I had one. Otherwise it seems just a hair more complex to manage for little benefit?

@nikomatsakis
Copy link
Contributor Author

I feel great about the term placeholder though! 👍

@bors
Copy link
Contributor

bors commented Sep 29, 2018

☔ The latest upstream changes (presumably #54278) made this pull request unmergeable. Please resolve the merge conflicts.

2. Replace all bound regions in the supertype with skolemized
equivalents. A "skolemized" region is just a new fresh region
2. Replace all bound regions in the supertype with placeholder
equivalents. A "placeholder" region is just a new fresh region
Copy link
Member

Choose a reason for hiding this comment

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

There are still some occurences of "skolemization" and "skolemize" used as a verb :p

snapshot: &CombinedSnapshot<'a, 'tcx>,
) {
debug!("pop_placeholders({:?})", placeholder_map);
let skol_regions: FxHashSet<_> = placeholder_map.values().cloned().collect();
Copy link
Member

Choose a reason for hiding this comment

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

skol_regions -> placeholders_regions

self.borrow_region_constraints()
.pop_skolemized(self.universe(), &skol_regions, &snapshot.region_constraints_snapshot);
.pop_placeholders(
&skol_regions,
Copy link
Member

Choose a reason for hiding this comment

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

same here

/// which can reach a skolemized region, or both. We call such regions
/// When working with placeholder regions, we often wish to find all of
/// the regions that are either reachable from a placeholder region, or
/// which can reach a placeholder region, or both. We call such regions
/// *tained* regions. This struct allows you to decide what set of
Copy link
Member

Choose a reason for hiding this comment

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

pre-existing: tained -> tainted

@@ -206,15 +206,15 @@ pub fn poly_project_and_unify_type<'cx, 'gcx, 'tcx>(

let infcx = selcx.infcx();
infcx.commit_if_ok(|snapshot| {
let (skol_predicate, skol_map) =
infcx.skolemize_late_bound_regions(&obligation.predicate);
let (skol_predicate, placeholder_map) =
Copy link
Member

Choose a reason for hiding this comment

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

Maybe find a better name for skol_predicate?
(multiple occurences in other files)

@nikomatsakis
Copy link
Contributor Author

@bors r=scalexm

@bors
Copy link
Contributor

bors commented Oct 3, 2018

📌 Commit 575ff54993c53359504cce139eb56e714e0712fb has been approved by scalexm

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 3, 2018
@bors
Copy link
Contributor

bors commented Oct 4, 2018

☔ The latest upstream changes (presumably #54624) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 4, 2018
@nikomatsakis
Copy link
Contributor Author

@bors r=scalexm

@bors
Copy link
Contributor

bors commented Oct 4, 2018

📌 Commit 85b9956 has been approved by scalexm

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 4, 2018
@bors
Copy link
Contributor

bors commented Oct 4, 2018

⌛ Testing commit 85b9956 with merge 8c4ad4e...

bors added a commit that referenced this pull request Oct 4, 2018
adopt "placeholders" to represent universally quantified regions

This does a few preliminary refactorings that lay some groundwork for moving towards universe integration. Two things, primarily:

- Rename from "skolemized" to "placeholder"
- When instantiating `for<'a, 'b, 'c>`, just create one universe for all 3 regions, and distinguish them from one another using the `BoundRegion`.
    - This is more accurate, and I think that in general we'll be moving towards a model of separating "binder" (universe, debruijn index) from "index within binder" in a number of places.
    - In principle, it feels the current setup of making lots of universes could lead to us doing the wrong thing, but I've actually not been able to come up with an example where this is so.

r? @scalexm
cc @arielb1
@bors
Copy link
Contributor

bors commented Oct 4, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: scalexm
Pushing 8c4ad4e to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants