Skip to content

don't ice on non-lifetime binders under -Zassumptions-on-binders#157807

Open
Dnreikronos wants to merge 2 commits into
rust-lang:mainfrom
Dnreikronos:assumptions_on_binders_non_lifetime_binder_ambiguity
Open

don't ice on non-lifetime binders under -Zassumptions-on-binders#157807
Dnreikronos wants to merge 2 commits into
rust-lang:mainfrom
Dnreikronos:assumptions_on_binders_non_lifetime_binder_ambiguity

Conversation

@Dnreikronos

@Dnreikronos Dnreikronos commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

fixes #157778

w/ -Znext-solver=globally -Zassumptions-on-binders and a non-lifetime binder we hit assert!(max_universe < u) in pull_region_outlives_constraints_out_of_universe and ICE.

the machinery here is region-outlives only, but a for<T> binder leaves a placeholder type in universe u that the region-only rewrite can't pull out, so an alias outlives like <!T as Trait>::Assoc: 'r reaches that assert still in u. just report ambiguity in that case, same as the None => Ambiguity bails right next to it — now it errors normally (E0284) instead of ICEing.

r? @lcnr

The region-constraint machinery for `-Zassumptions-on-binders` is
region-outlives-only. A non-lifetime binder (`for<T>`) introduces a
placeholder type in the binder's universe `u`. The rewrite that pulls
constraints out of `u` only folds regions (`PlaceholderReplacer` just
implements `fold_region`), so an alias-outlives constraint such as
`<!T as Trait>::Assoc: 'r` reaches
`pull_region_outlives_constraints_out_of_universe` still in `u` and
trips `assert!(max_universe < u)`.

Report ambiguity for those constraints instead of asserting, matching
the existing `None => Ambiguity` bail-outs in this module. The goal
then surfaces as an ordinary ambiguity error rather than an ICE.
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 12, 2026
@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 12, 2026
@lcnr

lcnr commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

r? BoxyUwU

@rustbot rustbot assigned BoxyUwU and unassigned lcnr Jun 12, 2026
@BoxyUwU

BoxyUwU commented Jun 19, 2026

Copy link
Copy Markdown
Member

can you move this logic into rewrite_type_outlives_constraints_in_universe_for_eager_placeholder_handling 🤔 it feels surprising that pull_region_outlives_constraints would do anything to type outlives constraints and similarly that rewrite_type_outlives_constraints wouldn't fully handle type outlives' :3

@Dnreikronos

Dnreikronos commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

done, moved this into rewrite_type_outlives_constraints_in_universe_for_eager_placeholder_handling.

pull_region_outlives_constraints_out_of_universe is back to just asserting that any ty-outlives constraint it sees was already moved below u. the alias rewrite handles the leftover non-lifetime placeholder case now, and turns it into ambiguity before the region-only pass runs.

idk if this is the exact shape you had in mind, but lgtm locally. imp bit is that pull_region_outlives_constraints_out_of_universe doesn't decide ty-outlives stuff anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ICE]: assumptions on binders: assertion failed: max_universe(infcx, constraint.clone()) < u

4 participants