Skip to content

fix: Assertion failure on dyn trait in closure - #22790

Open
Wilfred wants to merge 1 commit into
rust-lang:masterfrom
Wilfred:fix/deferred-call-unknown-closure-kind
Open

Wilfred wants to merge 1 commit into
rust-lang:masterfrom
Wilfred:fix/deferred-call-unknown-closure-kind

Conversation

@Wilfred

@Wilfred Wilfred commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Similarly to #22677, it's possible to get an assertion failure in HIR inference after error recovery.

The best repro I've found is actually the sample code from Rust issue
157951. I do think it's a legitimate fix, I've seen two real users hit this assertion.

Give up if we don't have a closure kind in
DeferredCallResolution::resolve(), and add a regression test that previously asserted.

AI disclosure: Implemented with some help by GPT-5.5.

Similarly to rust-lang#22677, it's possible to get an
assertion failure in HIR inference after error recovery.

The best repro I've found is actually the sample code from Rust issue
157951. I do think it's a legitimate fix, I've seen two real users hit
this assertion.

Give up if we don't have a closure kind in
DeferredCallResolution::resolve(), and add a regression test that
previously asserted.

AI disclosure: Implemented with some help by GPT-5.5.
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 14, 2026
@ChayimFriedman2
ChayimFriedman2 self-requested a review July 14, 2026 22:54
@ChayimFriedman2

Copy link
Copy Markdown
Contributor

Unlike the previous PR, this code was not changed in rustc and yet does not ICE. I want to understand why before removing the assertion.

@rustbot

rustbot commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (possibly #23181) made this pull request unmergeable. Please resolve the merge conflicts.

This branch has not been deployed

No deployments
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants