Region inference: split results from RegionInferenceContext#151688
Open
amandasystems wants to merge 1 commit intorust-lang:mainfrom
Open
Region inference: split results from RegionInferenceContext#151688amandasystems wants to merge 1 commit intorust-lang:mainfrom
amandasystems wants to merge 1 commit intorust-lang:mainfrom
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
This PR turns
RegionInferenceContextinto a builder that produces the inferred region values,InferredRegions. The resulting struct implements the public API ofRegionInferenceContextand replaces it inconsumers.rs.RegionInferenceContext::solve()now consumes (moves) the inference context. It is completely private to region inference.Why?
RegionInferenceContexthas become a huge dump for various values people want to access.region_inferitself is a very large file that's difficult to find your way around.RegionInferenceContextnow takes almost all of its fields by referenceKnock-on effects
RegionInferenceContextRegionInferenceContextnow almost exclusively contains references to values, as opposed to owning them. This addresses most offn compute_closure_requirements_modulo_opaquesshouldn't clone all its inputs #146079region_infergains two child modules and becomes a lot less of a behemoth.Detailed overview of changes
region_infer::constraint_searchandregion_infer::universal_regions.handle_placeholdersnow consumes less input and does constraint rewriting via mutable referencesconsumers.rsnow has aInferenceResultsinstead of aRegionInferenceContexteval_{equal, outlives}are moved toInferredRegionsConsumerOptionsis now calledInferredRegionscalculate_borrows_out_of_scope_at_locationof course now takesInferredRegionsLivenessValuesfor free regions is now initialised as live at all points along with the constraint rewriting during placeholder handling, as opposed to during construction ofRegionInferenceContextr? @lcnr
Closes #146079.