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

fix: Assertion failure on dyn trait in closure#22790
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.

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.

3 participants