Skip to content

trait_solver: Add minimal coroutine binder assumptions - #162159

Draft
Dnreikronos wants to merge 28 commits into
rust-lang:mainfrom
Dnreikronos:trait_solver/min_coroutine_assumptions
Draft

trait_solver: Add minimal coroutine binder assumptions#162159
Dnreikronos wants to merge 28 commits into
rust-lang:mainfrom
Dnreikronos:trait_solver/min_coroutine_assumptions

Conversation

@Dnreikronos

@Dnreikronos Dnreikronos commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

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_coroutines only 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.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 1, 2026
@rustbot rustbot added the WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) label Sep 1, 2026
@BoxyUwU BoxyUwU self-assigned this Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants