Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 0 additions & 47 deletions src/2026/assumptions_on_binders.md

This file was deleted.

72 changes: 72 additions & 0 deletions src/2026/next-gen-region-constraints.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Next-Gen Region Constraints

| Metadata | |
| :-- | :-- |
| Point of contact | @BoxyUwU |
| Roadmap | Project Zero |
| Status | Accepted |
| Tracking issue | [rust-lang/rust-project-goals#621] |
| Zulip channel | [#t-types/assumptions-on-binders][zulip] |
| [types] champion | @BoxyUwU |


## Summary

Rework the way we represent and handle region constraints in the compiler to unblock a bunch of important refactors and language features.

## Motivation

### The status quo

There are a number of things that we would like to do with the type system but currently cannot due to our region constraints and handling of not being advanced enough:
- Marker traits
- Proving auto traits for futures/coroutines (without lots of spurrious errors)
- Supporting implied bounds on uses of GATs (`where for<'a> T::Assoc<'a>: Trait`)
- Better handling of region constraints originating inside closures involving parent body regions
- Soundly supporting subtyping of higher ranked types and other functionality involving binders (`for<'a>`)
Comment on lines +22 to +26

@lcnr lcnr Jul 31, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mind linking to rust-lang tracking issues/bugs here?

View changes since the review


### What we propose to do about it

A lot of these end goals wind up being blocked on very similar and highly related issues.
We think we understand what it would take to get everything working here:
- Tracking where clauses on binders (`for<'a>`)
- OR region constraints
- Eagerly handle region and type outlives constraints involving placeholders (`for<'a>`)

Although we intend to significantly rework the way region constraints work in the type system.
we intend to do this incrementally with lots of small stabilizations along the way.

As a first step we're pursuing a minimal form of tracking implied bounds on binders which only
applies to some binders (couroutine witness types) and has very limited rules for how we take
into account these implied bounds when handling region constraints.

### Work items over the next year

| Task | Owner(s) | Notes |
| ---------------------------------------- | -------- | ----- |
| Custom testing DSL | @BoxyUwU | |
| Implement -Zassumptions_on_binders=min | @BoxyUwU | |
| Soft stabilize new region constraints | @BoxyUwU | |
| Stabilize a -Zassumptions_on_binders=min | @BoxyUwU | |

## Team asks

| Team | Support level | Notes |
| ---------- | ------------- | --------------------------------------- |
| [types] | Large | Be kept abrest of the design work and sign off on stabilizations |

## Frequently asked questions

### Interactions with -Zhigher-ranked-assumptions

The `-Zhigher-ranked-assumptions` flag currently exists and tries so solve some of the problems caused by this, but it is not fully general and likely not the implementation strategy we want when solving all problems in this area.

@lcnr lcnr Jul 31, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The `-Zhigher-ranked-assumptions` flag currently exists and tries so solve some of the problems caused by this, but it is not fully general and likely not the implementation strategy we want when solving all problems in this area.
The `-Zhigher-ranked-assumptions` flag currently exists and tries so solve some of the problems caused by this, it does so in a very targeted way and cannot be easily generalized to support all our use-cases.

View changes since the review


Ideally we would implement a version of `-Zhigher-ranked-assumptions` which works for *all* binders, not just witness types of futures. And ideally it would be cleverer and handle the transitiveness of outlives assumptions, much like we do for normal region outlives where clauses.

This goal will likely subsume the `-Zhigher-ranked-assumptions` flag, though we do intend to pursue a minimal stabilization of something quite similar to it.
Comment on lines +64 to +66

@lcnr lcnr Jul 31, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Ideally we would implement a version of `-Zhigher-ranked-assumptions` which works for *all* binders, not just witness types of futures. And ideally it would be cleverer and handle the transitiveness of outlives assumptions, much like we do for normal region outlives where clauses.
This goal will likely subsume the `-Zhigher-ranked-assumptions` flag, though we do intend to pursue a minimal stabilization of something quite similar to it.
This work subsumes `-Zhigher-ranked-assumptions` with an implementation which will for *all* binders, not just coroutine witness types. It handles the transitiveness of outlives assumptions, much like we do for normal region outlives where clauses and will handles arbitrary `TypeOutlives` constraints.

View changes since the review


### Interactions with Polonius

This goal is only intending to change how we handle regions *before* borrow checking and should in theory not interact with borrow checking other than resulting in potentially different region constraints for the borrow checker to check.

@lcnr lcnr Jul 31, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This goal is only intending to change how we handle regions *before* borrow checking and should in theory not interact with borrow checking other than resulting in potentially different region constraints for the borrow checker to check.
This goal only changes how we handle region constraints before passing them to borrow checking and should in theory not interact with borrow checking other than changing the set of relevant region constraints. It is entirely distinct from polonius.

View changes since the review


[zulip]: https://rust-lang.zulipchat.com/#topics/channel/606332-t-types.2Fassumptions-on-binders
Loading