fix: add CoroutineClosure and Error arms to simplify_nounwind_call#481
Open
SebTardif wants to merge 2 commits into
Open
fix: add CoroutineClosure and Error arms to simplify_nounwind_call#481SebTardif wants to merge 2 commits into
SebTardif wants to merge 2 commits into
Conversation
Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
This was referenced Jun 19, 2026
Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #477
simplify_nounwind_callininstsimplify.rsmatches onbody_ty.kind()to determine the ABI of a callee, but the match is missingty::CoroutineClosure(..) => ExternAbi::RustCallandty::Error(_) => return. The catch-all_ => bug!(...)causes an ICE when the callee is an async closure (which desugars toCoroutineClosure).Failure scenario
When MIR optimization encounters a
Callterminator whose callee is a coroutine closure body,type_of(def_id)returnsty::CoroutineClosure. The match falls through tobug!("unexpected body ty"), causing an Internal Compiler Error. Async closures have been stable since Rust 1.85, making this reachable on stable.Fix
Add the two missing arms, matching the pattern used by three sibling functions in the same crate (
validate.rs:57,abort_unwinding_calls.rs:55,ffi_unwind_calls.rs:30) that all include bothCoroutineClosureandErrorhandling.Bug origin
The
CoroutineClosurevariant was added to TyKind as part of the async closures feature. The three sibling functions were updated, butsimplify_nounwind_callwas missed.