Skip to content

-Znext-solver : Abort on the first overflowed obligation in fulfillment - #162223

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
adwinwhite:abort-on-fulfillment-overflow
Sep 11, 2026
Merged

-Znext-solver : Abort on the first overflowed obligation in fulfillment#162223
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
adwinwhite:abort-on-fulfillment-overflow

Conversation

@adwinwhite

@adwinwhite adwinwhite commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Fixes rust-lang/trait-system-refactor-initiative#294 cc https://rust-lang.zulipchat.com/#narrow/channel/618216-t-types.2Fcall-for-participation/topic/handling.20overflow.20in.20fulfill/with/621040305

We used to drop all subsequent obligations when one obligation overflows in fulfillment. It means that we don't really prove all obligations even if fulfillment has no pending obligations and returns no error. We now eagerly abort on the first overflowed obligation.

r? @ShoyuVanilla
cc @lcnr

@rustbot

rustbot commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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) labels Sep 3, 2026
// We limit the total count of inference progress to avoid hang so we don't
// try to recover from this.
// It's more complicated to collect all overflows so we stopped doing that.
// This is consistent with the old solver's behavior.

@lcnr lcnr Sep 3, 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.

please also note how it's incredibly rare to actually encounter fulfillment overflow as a single goal would have to result in different inference progress a recursion_depth number of times. This mostly happens in bugs or with Subtype obligations because we no longer use the sub_unification_table in generalize 🤔 also, style question

we currently check depth after incrementing it, which seems odd. Should we flip it around and instead check depth before incrementing it in the else branch?

View changes since the review

@lcnr

lcnr commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

couldn't not look at this 😅

@ShoyuVanilla please still look at this PR as it's useful, but

r? lcnr
r=me after nits

@rustbot rustbot assigned lcnr and unassigned ShoyuVanilla Sep 3, 2026

@ShoyuVanilla ShoyuVanilla left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Makes sense to me as well 😄

View changes since this review

@theemathas

Copy link
Copy Markdown
Contributor

Is this code path reachable from coherence in stable rust?

@adwinwhite

adwinwhite commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Is this code path reachable from coherence in stable rust?

One possibility is that one impl specializes another and their overlapping computing has overflowed obligations in fulfillment. I am having trouble constructing a test for this though.

@adwinwhite

adwinwhite commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Thinking about specialization a little more. I guess we can assume that if one impl specializes another, they can't have overflowed obligations in fulfillment when computing impossible intersection. The feeling is that the parent's predicates must be provable in the child's param env, so their fresh clauses probably wouldn't progress each other alternatively when put in the same fulfillment.

@lcnr

lcnr commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Is this code path reachable from coherence in stable rust?

yes, though given the difficulty of actually triggering fulfillment overflow without uses of opaque types, I don't think this is practically observable, I guess a quick types nomination

@lcnr lcnr added the I-types-nominated Nominated for discussion during a types team meeting. label Sep 3, 2026
@adwinwhite
adwinwhite force-pushed the abort-on-fulfillment-overflow branch from a6c578a to 85c8774 Compare September 3, 2026 10:35
@rust-bors

This comment has been minimized.

@lcnr lcnr removed the I-types-nominated Nominated for discussion during a types team meeting. label Sep 10, 2026
@lcnr

lcnr commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

r=me after rebase :3

@adwinwhite
adwinwhite force-pushed the abort-on-fulfillment-overflow branch from 85c8774 to 3dab168 Compare September 11, 2026 01:57
@rustbot

rustbot commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@adwinwhite

Copy link
Copy Markdown
Contributor Author

@bors r=lcnr

@rust-bors

rust-bors Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 3dab168 has been approved by lcnr

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 11, 2026
@adwinwhite

adwinwhite commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

Forgot to commit auto formatting :/
@bors r-

@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 11, 2026
@rust-bors

rust-bors Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

View changes since this unapproval

@adwinwhite
adwinwhite force-pushed the abort-on-fulfillment-overflow branch from 3dab168 to 96536dd Compare September 11, 2026 02:01
@adwinwhite

Copy link
Copy Markdown
Contributor Author

@bors r=lcnr

@rust-bors

rust-bors Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 96536dd has been approved by lcnr

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 11, 2026
rust-bors Bot pushed a commit that referenced this pull request Sep 11, 2026
…uwer

Rollup of 3 pull requests

Successful merges:

 - #162223 (`-Znext-solver` : Abort on the first overflowed obligation in fulfillment)
 - #161654 (Eagerly report overflow errors in normalization query)
 - #162176 (Clean up some small things related to lint `ambiguous_glob_imported_traits`)
@rust-bors
rust-bors Bot merged commit 6b55536 into rust-lang:main Sep 11, 2026
13 checks passed
rust-bors Bot pushed a commit that referenced this pull request Sep 11, 2026
Rollup merge of #162223 - adwinwhite:abort-on-fulfillment-overflow, r=lcnr

`-Znext-solver` : Abort on the first overflowed obligation in fulfillment

Fixes rust-lang/trait-system-refactor-initiative#294 cc https://rust-lang.zulipchat.com/#narrow/channel/618216-t-types.2Fcall-for-participation/topic/handling.20overflow.20in.20fulfill/with/621040305

We used to drop all subsequent obligations when one obligation overflows in fulfillment. It means that we don't really prove all obligations even if fulfillment has no pending obligations and returns no error. We now eagerly abort on the first overflowed obligation.

r? @ShoyuVanilla
cc @lcnr
@rustbot rustbot added this to the 1.100.0 milestone Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

try_evaluate_obligations drops the in-flight obligation

5 participants