-
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
clear out projection subobligations after they are processed #43999
Conversation
src/librustc/traits/project.rs
Outdated
} | ||
}; | ||
|
||
// Now that the |
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.
Missing line?
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.
Yea
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.
This makes a lot of sense. Have you measured the impact on performance?
src/librustc/traits/fulfill.rs
Outdated
@@ -475,7 +475,8 @@ fn process_predicate<'a, 'gcx, 'tcx>( | |||
trait_ref_type_vars(selcx, data.to_poly_trait_ref(tcx)); | |||
Ok(None) | |||
} | |||
Ok(v) => Ok(v), | |||
// FIXME: call ProjectionCache::complete when we can. |
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.
This would basically be when the obligation forest decides we are done with a projection predicate, right? In other words, the FIXME is sort of in the wrong place? I would expect us to iterate over outcome.completed
(elsewhere in fulfill.rs
...) and invoke complete()
from there.
@arielb1 should this be nominated for a backport? |
@alexcrichton I think that @arielb1 backed out the relevant code for beta, so this applies to nightly only. |
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
962ffb2
to
7534f73
Compare
Added comments. |
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.
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.
Nice comments. r=me.
@bors r+ |
📌 Commit 7534f73 has been approved by |
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
☀️ Test successful - status-appveyor, status-travis |
beta-nominating for 1.21 |
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.
[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.
Marking as beta-accepted. Medium patch, but important. cc @rust-lang/compiler |
Backporting now. |
Beta 20170928 Backports of: - Allow unused extern crate again #44825 - macros: fix bug in collecting trait and impl items with derives. #44757 - `--cap-lints allow` switches off `can_emit_warnings` #44627 - Update the libc submodule #44116 - limit and clear cache obligations opportunistically #44269 - clear out projection subobligations after they are processed #43999
Beta 20170928 Backports of: - Allow unused extern crate again #44825 - macros: fix bug in collecting trait and impl items with derives. #44757 - `--cap-lints allow` switches off `can_emit_warnings` #44627 - Update the libc submodule #44116 - limit and clear cache obligations opportunistically #44269 - clear out projection subobligations after they are processed #43999 - fix logic error in #44269's `prune_cache_value_obligations` #45065 - REVERTS #43543: Cleanup some remains of `hr_lifetime_in_assoc_type` compatibility lint:
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