-
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
Deduplicate identical region constraints in new solver #112442
Deduplicate identical region constraints in new solver #112442
Conversation
Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor |
What do you mean by this, the new solver has both the provisional and global cache |
Yeah, but in the new solver these results are canonicalized, and as a consequence we always end up instantiating the region constraints from these goals every time we evaluate it in the new solver even if we're not doing any deep goal solving or anything. In contrast, if you register a goal in an old-style obligation forest that's already been processed, it won't re-register it at all and we never end up instantiating its region obligations once again: rust/compiler/rustc_data_structures/src/obligation_forest/mod.rs Lines 340 to 343 in 68c8fda
In the example, I'm essentially creating a case where we end up instantiating a pathologically large number of outlives constraints that wouldn't be registered in the old solver because of the way it doesn't reprocess (and therefore re-register region constraints for) a goal that it already knows it has solved. |
I think this is also kinda inevitable unless you have a fulfillment context which adds nested obligations into the root @bors r+ rollup |
…icate-region-constraints, r=lcnr Deduplicate identical region constraints in new solver the new solver doesn't track whether we've already proven a goal like the fulfillment context's obligation forest does, so we may be instantiating a canonical response (and specifically, its nested region obligations) quite a few times. This may lead to exponentially gathering up identical region constraints for things like auto traits, so let's deduplicate region constraints when in `compute_external_query_constraints`. r? `@lcnr`
…llaumeGomez Rollup of 3 pull requests Successful merges: - rust-lang#112260 (Improve document of `unsafe_code` lint) - rust-lang#112429 ([rustdoc] List matching impls on type aliases) - rust-lang#112442 (Deduplicate identical region constraints in new solver) r? `@ghost` `@rustbot` modify labels: rollup
the new solver doesn't track whether we've already proven a goal like the fulfillment context's obligation forest does, so we may be instantiating a canonical response (and specifically, its nested region obligations) quite a few times.
This may lead to exponentially gathering up identical region constraints for things like auto traits, so let's deduplicate region constraints when in
compute_external_query_constraints
.r? @lcnr