Track closure signatures & kinds in freshened types#43938
Track closure signatures & kinds in freshened types#43938bors merged 1 commit intorust-lang:masterfrom
Conversation
src/librustc/infer/freshen.rs
Outdated
There was a problem hiding this comment.
Should be possible to call mk_substs on the iterator here.
nikomatsakis
left a comment
There was a problem hiding this comment.
OK, I get the idea here -- this is clever. The other approach that I had been contemplating was slightly different. I had hoped to add facts to the environment indicating when we know the kind of a closure (rather than invoking closure_kind, basically). In this way, we would invalidate the cached entries because there would be a new environment. But I think this is a simpler thing to do for now for sure (and maybe forever -- since I was worried about screwing up the caching results of other things if we grow the param env).
src/librustc/infer/freshen.rs
Outdated
There was a problem hiding this comment.
feels like some comments laying out the strategy here would be very welcome
After a projection was processed, its derived subobligations no longer need any processing when encountered, and can be removed. This improves the status of rust-lang#43787. This is actually complementary to rust-lang#43938 - that PR fixes selection caching (and @remram44's example, which "accidentally" worked because of the buggy projection caching) while this PR fixes projection caching
|
Now with cleaner code & comments & hopefully ready for landing! |
|
NOTE: this PR will require some changes after #43076 lands, so I'll have this (unchanged) version for beta and a modified version for master. |
|
☔ The latest upstream changes (presumably #43076) made this pull request unmergeable. Please resolve the merge conflicts. |
clear out projection subobligations after they are processed After a projection was processed, its derived subobligations no longer need any processing when encountered, and can be removed. This improves the status of #43787. This is actually complementary to #43938 - that PR fixes selection caching (and @remram44's example, which "accidentally" worked because of the buggy projection caching) while this PR fixes projection caching. r? @nikomatsakis
This allows caching closure signatures and kinds in the normal selection and evaluation caches, and fixes the exponential worst-case in @remram44's example, which is a part of rust-lang#43787. This improvement is complenentary to rust-lang#43999 - they fix different cases.
|
Rebased |
| //! comparisons (for caching), it is possible to do a `ty::_match` operation between | ||
| //! 2 freshened types - this works even with the closure encoding. | ||
| //! | ||
| //! __An important detail concerning regions.__ The freshener also replaces *all* free regions with |
|
@bors r+ |
|
📌 Commit 75d6820 has been approved by |
|
⌛ Testing commit 75d6820 with merge 2edfd62c37290bd1a24da88a4aee315ed4c1cfdf... |
|
💔 Test failed - status-travis |
@bors retry |
|
Please don't roll this up as this is a performance improvement PR. |
|
@bors p=100 |
Track closure signatures & kinds in freshened types r? @nikomatsakis
|
☀️ Test successful - status-appveyor, status-travis |
[beta] Track closure signatures & kinds in freshened types This allows caching closure signatures and kinds in the normal selection and evaluation caches, and fixes the exponential worst-case in @remram44's example, which is a part of #43787. This improvement is complenentary to #43999 - they fix different cases. This is the pre-generators variation of #43938, cloned for beta.
After a projection was processed, its derived subobligations no longer need any processing when encountered, and can be removed. This improves the status of rust-lang#43787. This is actually complementary to rust-lang#43938 - that PR fixes selection caching (and @remram44's example, which "accidentally" worked because of the buggy projection caching) while this PR fixes projection caching
r? @nikomatsakis