-
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
Refactor propagation to be more explicit #32730
Comments
Replace consider_unification_despite_ambiguity with new obligation variant Is work towards #32730. Addresses part one of #32286. Addresses #24210 and #26046 to some degree. r? @nikomatsakis
A note (both for myself to walk back to and I guess as a minor update): |
cc me |
@soltanmm I have a branch that is using the plumbing now to handle all region obligations. It's not quite right for higher-ranked stuff yet -- but seems to basically work: failures: test result: FAILED. 2465 passed; 19 failed; 13 ignored; 0 measured |
This is the branch https://github.com/nikomatsakis/rust/tree/region-obligations |
I've been plugging away on the higher-ranked code. It's coming along, but it's a bit trickier than I naively expected (e.g., I forgot about I'm thinking more and more I need to writeup the overall plan here. I still think we're on the right track, but the end-game is complicated. (e.g., in order to make lazy norm and higher-ranked stuff work -- which is of course one of the main motivations -- is going to require some refactoring to better handle higher-ranked reasoning in general.) Sorry, I know this is vague, just don't have time for such a write-up this second. |
[4/n] rustc: harden against InferOk having obligations in more cases. _This is part of a series ([prev](#37402) | [next](#37408)) of patches designed to rework rustc into an out-of-order on-demand pipeline model for both better feature support (e.g. [MIR-based](https://github.com/solson/miri) early constant evaluation) and incremental execution of compiler passes (e.g. type-checking), with beneficial consequences to IDE support as well. If any motivation is unclear, please ask for additional PR description clarifications or code comments._ <hr> This adds more asserts that `InferOk` results have no obligations, pending completion of #32730. Each of these could accidentally drop obligations on the floor if they start getting produced by unification, and a future change does just that, in order to produce a "shallow success" (hopefully leading to ambiguities during trait selection), _without_ the possibility of an eventual success - mostly guarded by ICEs for now.
Or at least, more properly. I think I left one or two FIXMEs still in there. cc rust-lang#32730
cc rust-lang#32730 -- I left exactly one instance where I wasn't sure of the right behavior.
@nikomatsakis Could you provide an update on this? |
IIRC all the reasons to do this are similarly addressed by efforts in Chalk and its eventual integration (though I'm saying this as someone who's been out of the loop for a while). |
@Mark-Simulacrum getting there, still some FIXMEs related to this issue. I hope to be resolving them soon. (ps @soltanmm, we should chat, I don't have your new e-mail) |
I'd call this done. |
In conjunction with @soltanmm, and with an aim towards enabling lazy normalization, HR-caching, specialization's lifetime dispatch rules, and a number of other things, we should refactor the way we propagate obligations and mutable state through the inference context.
The general idea is to make the result of unification also carry a list of obligations. This can be used by lazy normalizing to carry the results of normalization, but we should also (eventually) move all mutation of the region inference state out and use it to carry region edges that result. This will help simplify the skolemization code, with the lifetime dispatch logic, and with more advanced caching. It might also make sense to eventually move the unification of type variables too, so that unify is a pure function.
At the moment, this issue exists mainly to serve as a placeholder for FIXME, but I hope to expand with a bit more design and also some checklist of to-do items. :)
The text was updated successfully, but these errors were encountered: