-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
handle universes in canonicalization #48696
Comments
Definitely interested in working through this |
Since `ReSkolemized` has the flag `KEEP_IN_LOCAL_TCX`, and canonicalization is meant to ensure that flag is no longer present, it implicitly is depending on the existence of the leak check. However, since we want to remove that in rust-lang#48407, we can no longer make that assumption. This is related to rust-lang#48696, but does not resolve it. This does unblock that PR, however. It could have been tacked on there, but I wanted to make sure this is a reasonable short term approach separately from that.
@sgrif ok so I was thinking about this last night after we talked. My PR to move skolemized things into the global tcx works, but as I said on gitter I'm now revisiting that question. Maybe you were onto something in #49598. Perhaps we could set it up like so: When you canonicalize, we replace skolemized regions with canonical variables, as in your PR. We would also add information to rust/src/librustc/infer/canonical.rs Lines 85 to 87 in 4bf76d6
Then when we instantiate each canonical variable, we would create "skolemized" variables for those things that were skolemized (in the appropriate universe): rust/src/librustc/infer/canonical.rs Lines 247 to 251 in 4bf76d6
I think we could start with "identity mapping" between universes, in which case we would still need to carry (in the Once we add a real map, I think we could put the map into rust/src/librustc/infer/canonical.rs Lines 76 to 78 in 4bf76d6
then rust/src/librustc/infer/canonical.rs Line 288 in 4bf76d6
and use the info to do the mapping. |
Makes sense. Thanks for looking into it |
@nikomatsakis Sorry for the radio silence, I've been at a conference the last week. After poking at the solution you described, I think we need to take #49598 as an intermediate step. |
I think this stuff is basically fixed by #55305 — we're not doing anything smart yet, but we're handling things correctly now iirc |
Add placeholder types Fixes rust-lang#48696 (handle universes in canonicalization of type inference vars), and fixes rust-lang#55098.
Now that #47861 has landed, there is a notion of universes for type variables. For now, in order to get #48411 landed, the canonicalization code is simply using
UniverseIndex::ROOT
for the universes of type variables it creates (those universes aren't really being used anyway presently).However, what we ought to be doing is recording (during canonicalization) the universe of the variables that are being fed in. We can then canonicalize those universes (what chalk calls
u_canonicalize
) and then recreate them on the other side. And finally we map the universes back.I'll try to leave more detailed notes later. I expect to either do this or mentor this as follow-up.
cc @sgrif
The text was updated successfully, but these errors were encountered: