trait_solver: Add minimal coroutine binder assumptions - #162159
Draft
Dnreikronos wants to merge 28 commits into
Draft
trait_solver: Add minimal coroutine binder assumptions#162159Dnreikronos wants to merge 28 commits into
Dnreikronos wants to merge 28 commits into
Conversation
Keep type-outlives constraints intact while leaving a minimal-mode binder, then remove only leaves proven by that binder. Ordinary binders continue through the normal eager leak check.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Implements rust-lang/project-assumptions-on-binders#33.
Based on #161306, so the diff is going to look noisy until that lands.
The full binder-assumptions mode does a lot when it leaves a binder, including rewriting placeholder constraints into lower universes. For coroutine witnesses we only need a much smaller bit of that. The main thing I wanted to avoid was making a "minimal" flag that quietly got most of the full behavior anyway.
min_coroutinesonly builds assumptions for coroutine-witness binders. When it leaves one, it drops a constraint if that binder directly proves it and keeps the rest for the root context. Ordinary HRTBs still take the normal eager leak-check path. Type-outlives constraints also stay whole until the root; pulling them apart earlier can make the mode accept more than intended.Fwiw I think this is a nicer first version because the rule is pretty easy to explain: witness binders get assumptions, other binders don't. It gets the async cases we're after without turning on the wider experiment. I added the existing async examples and a couple of focused tests for the edges that worried me, ordinary binders and unsatisfied constraints leaving the binder.