Skip to content

coroutines: Skip the closure signature annotation check for tainted bodies#155218

Merged
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
jakubadamw:issue-139570
Apr 14, 2026
Merged

coroutines: Skip the closure signature annotation check for tainted bodies#155218
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
jakubadamw:issue-139570

Conversation

@jakubadamw
Copy link
Copy Markdown
Contributor

@jakubadamw jakubadamw commented Apr 12, 2026

When a coroutine has too many parameters, check_match fails and construct_error builds a MIR body with only the coroutine's computed arguments (env + resume type). The user-provided signature, however, still reflects all the parameters the user wrote. check_signature_annotation then tries to zip_eq these two mismatched iterators, causing a panic. Checking tainted_by_errors and bailing early avoids this, since construct_error bodies cannot meaningfully be compared against user annotations.

Example currently ICEing:

fn main() {
    |(1, 42), ()| yield;
}

Closes #139570.

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 12, 2026

This PR changes a file inside tests/crashes. If a crash was fixed, please move into the corresponding ui subdir and add 'Fixes #' to the PR description to autoclose the issue upon merge.

@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. labels Apr 12, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 12, 2026

r? @chenyukang

rustbot has assigned @chenyukang.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 69 candidates
  • Random selection from 12 candidates

@tiif
Copy link
Copy Markdown
Member

tiif commented Apr 13, 2026

r? tiif

@rustbot rustbot assigned tiif and unassigned chenyukang Apr 13, 2026
Comment thread compiler/rustc_borrowck/src/type_check/input_output.rs Outdated
@tiif
Copy link
Copy Markdown
Member

tiif commented Apr 13, 2026

Other than a nit, it looks good, thanks!

Could you also squash the commits?

@rustbot author

@rustbot rustbot 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-review Status: Awaiting review from the assignee but also interested parties. labels Apr 13, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 13, 2026

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@jakubadamw
Copy link
Copy Markdown
Contributor Author

jakubadamw commented Apr 13, 2026

@tiif, thank you!

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 13, 2026
@rust-log-analyzer

This comment has been minimized.

When a coroutine has too many parameters, `check_match` fails and
`construct_error` builds a MIR body with only the coroutine's computed
args (env + resume type). The user-provided signature, however, still
reflects all the parameters the user wrote. `check_signature_annotation`
then tries to `zip_eq` these two mismatched iterators, causing a panic.
Checking `tainted_by_errors` and bailing early avoids this, since
`construct_error` bodies cannot meaningfully be compared against user
annotations.
@tiif
Copy link
Copy Markdown
Member

tiif commented Apr 14, 2026

thanks!

@bors r+ rollup

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 14, 2026

📌 Commit d14be60 has been approved by tiif

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 Apr 14, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 14, 2026
coroutines: Skip the closure signature annotation check for tainted bodies

When a coroutine has too many parameters, `check_match` fails and `construct_error` builds a MIR body with only the coroutine's computed arguments (env + resume type). The user-provided signature, however, still reflects all the parameters the user wrote. `check_signature_annotation` then tries to `zip_eq` these two mismatched iterators, causing a panic. Checking `tainted_by_errors` and bailing early avoids this, since `construct_error` bodies cannot meaningfully be compared against user annotations.

Example currently ICEing:

```rust
fn main() {
    |(1, 42), ()| yield;
}
```

Closes rust-lang#139570.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 14, 2026
coroutines: Skip the closure signature annotation check for tainted bodies

When a coroutine has too many parameters, `check_match` fails and `construct_error` builds a MIR body with only the coroutine's computed arguments (env + resume type). The user-provided signature, however, still reflects all the parameters the user wrote. `check_signature_annotation` then tries to `zip_eq` these two mismatched iterators, causing a panic. Checking `tainted_by_errors` and bailing early avoids this, since `construct_error` bodies cannot meaningfully be compared against user annotations.

Example currently ICEing:

```rust
fn main() {
    |(1, 42), ()| yield;
}
```

Closes rust-lang#139570.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 14, 2026
coroutines: Skip the closure signature annotation check for tainted bodies

When a coroutine has too many parameters, `check_match` fails and `construct_error` builds a MIR body with only the coroutine's computed arguments (env + resume type). The user-provided signature, however, still reflects all the parameters the user wrote. `check_signature_annotation` then tries to `zip_eq` these two mismatched iterators, causing a panic. Checking `tainted_by_errors` and bailing early avoids this, since `construct_error` bodies cannot meaningfully be compared against user annotations.

Example currently ICEing:

```rust
fn main() {
    |(1, 42), ()| yield;
}
```

Closes rust-lang#139570.
rust-bors Bot pushed a commit that referenced this pull request Apr 14, 2026
…uwer

Rollup of 7 pull requests

Successful merges:

 - #154049 (delegation: Track more precise spans for glob delegations)
 - #155134 (Replace custom trim_ascii_start with the standard library method)
 - #155235 (add the `fma4` x86 target feature)
 - #155218 (coroutines: Skip the closure signature annotation check for tainted bodies)
 - #155274 (limit duplicate-profiler-builtins test to targets that can do dynamic linking)
 - #155276 (`#[rustc_must_match_exhaustively]` detect let else)
 - #155281 (Revert "allow `windows-gnu` targets to embed gdb visualizer scripts")
@rust-bors rust-bors Bot merged commit aed02c5 into rust-lang:main Apr 14, 2026
11 checks passed
@rustbot rustbot added this to the 1.97.0 milestone Apr 14, 2026
rust-timer added a commit that referenced this pull request Apr 14, 2026
Rollup merge of #155218 - jakubadamw:issue-139570, r=tiif

coroutines: Skip the closure signature annotation check for tainted bodies

When a coroutine has too many parameters, `check_match` fails and `construct_error` builds a MIR body with only the coroutine's computed arguments (env + resume type). The user-provided signature, however, still reflects all the parameters the user wrote. `check_signature_annotation` then tries to `zip_eq` these two mismatched iterators, causing a panic. Checking `tainted_by_errors` and bailing early avoids this, since `construct_error` bodies cannot meaningfully be compared against user annotations.

Example currently ICEing:

```rust
fn main() {
    |(1, 42), ()| yield;
}
```

Closes #139570.
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ICE: yield: itertools: .zip_eq() reached end of one iterator before the other

5 participants