-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Conversation
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? |
I feel great about the term placeholder though! 👍 |
☔ 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 |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pre-existing: tained
-> tainted
src/librustc/traits/project.rs
Outdated
@@ -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) = |
There was a problem hiding this comment.
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)
591c2ac
to
575ff54
Compare
@bors r=scalexm |
📌 Commit 575ff54993c53359504cce139eb56e714e0712fb has been approved by |
☔ The latest upstream changes (presumably #54624) made this pull request unmergeable. Please resolve the merge conflicts. |
575ff54
to
fe04fe2
Compare
Avoids a linear walk over the regions at the end.
fe04fe2
to
85b9956
Compare
@bors r=scalexm |
📌 Commit 85b9956 has been approved by |
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
☀️ Test successful - status-appveyor, status-travis |
This does a few preliminary refactorings that lay some groundwork for moving towards universe integration. Two things, primarily:
for<'a, 'b, 'c>
, just create one universe for all 3 regions, and distinguish them from one another using theBoundRegion
.r? @scalexm
cc @arielb1