Skip to content

reject non-async coroutine closures as async callables - #163832

Open
amirHdev wants to merge 1 commit into
rust-lang:mainfrom
amirHdev:reject-non-async-coroutine-closures
Open

amirHdev wants to merge 1 commit into
rust-lang:mainfrom
amirHdev:reject-non-async-coroutine-closures

Conversation

@amirHdev

@amirHdev amirHdev commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

fixes rust-lang/trait-system-refactor-initiative#302

reject non-async coroutine closures in async callable extraction

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Oct 5, 2026
@amirHdev
amirHdev marked this pull request as ready for review October 6, 2026 09:00
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 6, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Oct 6, 2026
@rustbot

rustbot commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

r? @dingxiangfei2009

rustbot has assigned @dingxiangfei2009.
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 77 candidates
  • Random selection from 17 candidates

@amirHdev

amirHdev commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

r? lcnr

@rustbot rustbot assigned lcnr and unassigned dingxiangfei2009 Oct 7, 2026
@lcnr

lcnr commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

seems fine i think, unsure what's the best way to actually check this, feels a bit iffy to have to go through the associated coroutine

r? oli-obk

@rustbot rustbot assigned oli-obk and unassigned lcnr Oct 7, 2026
@oli-obk

oli-obk commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

unsure what's the best way to actually check this, feels a bit iffy to have to go through the associated coroutine

it's what we do in the old solver

self.tcx().coroutine_kind(self.tcx().coroutine_for_closure(def_id))

I don't really see a better way, it's exactly what we want to check after all

Comment thread tests/ui/iterators/iter-macro-not-async-closure.rs Outdated
@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 Oct 8, 2026
@rustbot

rustbot commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

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

@amirHdev
amirHdev force-pushed the reject-non-async-coroutine-closures branch from 5d04cb7 to 59f962a Compare October 8, 2026 09:46
Comment thread tests/ui/iterators/iter-macro-not-async-closure.rs Outdated
Comment thread tests/ui/iterators/iter-macro-not-async-closure-simplified.rs Outdated
Comment thread tests/ui/iterators/generator_capture_2.rs Outdated
Comment thread tests/ui/iterators/generator_capture_2.rs Outdated
@amirHdev
amirHdev force-pushed the reject-non-async-coroutine-closures branch from 59f962a to 449aa3b Compare October 8, 2026 09:58
@amirHdev

amirHdev commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Oct 8, 2026
@amirHdev
amirHdev requested a review from oli-obk October 8, 2026 10:00
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 8, 2026
Comment thread tests/ui/iterators/generator_capture_2.rs Outdated
@amirHdev
amirHdev force-pushed the reject-non-async-coroutine-closures branch from 449aa3b to 824c4c0 Compare October 8, 2026 10:46

@oli-obk oli-obk left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rust-bors

rust-bors Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 824c4c0 has been tentatively approved by oli-obk

It will be put into the queue for this repository once PR CI succeeds.

@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 Oct 8, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 8, 2026
…e-closures, r=oli-obk

reject non-async coroutine closures as async callables

fixes rust-lang/trait-system-refactor-initiative#302

reject non-async coroutine closures in async callable extraction
rust-bors Bot pushed a commit that referenced this pull request Oct 8, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - #163462 (Fix COFF renaming of decorated (stdcall/fastcall/vectorcall) exports)
 - #163855 (Include enclosing item's context on const errors)
 - #163861 (Run LLDB debuginfo tests on `x86_64-mingw`)
 - #163538 (Add `rustc::missing_generic_type_visitable` lint)
 - #163617 (mips: make `Complex<T>` ABI match GCC)
 - #163832 (reject non-async coroutine closures as async callables)
 - #163958 (only make `RustaceansAreAwesome` satisfy trait clauses)
 - #163974 (Condense AdtDef lang item checks into one match)
 - #163979 (Add `bf16` to arm features)

Failed merges:

 - #163972 (const-eval: ICE when we hit a non-const fn)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 8, 2026
…e-closures, r=oli-obk

reject non-async coroutine closures as async callables

fixes rust-lang/trait-system-refactor-initiative#302

reject non-async coroutine closures in async callable extraction
rust-bors Bot pushed a commit that referenced this pull request Oct 8, 2026
…uwer

Rollup of 12 pull requests

Successful merges:

 - #163462 (Fix COFF renaming of decorated (stdcall/fastcall/vectorcall) exports)
 - #163855 (Include enclosing item's context on const errors)
 - #163861 (Run LLDB debuginfo tests on `x86_64-mingw`)
 - #161201 (Speed up tidy again)
 - #163538 (Add `rustc::missing_generic_type_visitable` lint)
 - #163617 (mips: make `Complex<T>` ABI match GCC)
 - #163772 (comptime fn error: suggest wrapping in const block)
 - #163832 (reject non-async coroutine closures as async callables)
 - #163958 (only make `RustaceansAreAwesome` satisfy trait clauses)
 - #163974 (Condense AdtDef lang item checks into one match)
 - #163979 (Add `bf16` to arm features)
 - #163989 (Revert "compiletest: stream output of executor process when --no-capture is set")

Failed merges:

 - #163972 (const-eval: ICE when we hit a non-const fn)
rust-bors Bot pushed a commit that referenced this pull request Oct 8, 2026
…uwer

Rollup of 19 pull requests

Successful merges:

 - #156112 (Distinguish `repr(C)` ZSTs from others in ABI computation)
 - #157941 (Deny partial `-Z stack-protector` by default in all editions)
 - #163462 (Fix COFF renaming of decorated (stdcall/fastcall/vectorcall) exports)
 - #163855 (Include enclosing item's context on const errors)
 - #163861 (Run LLDB debuginfo tests on `x86_64-mingw`)
 - #163913 ( Silence redundant failed obligations on the same statement)
 - #161201 (Speed up tidy again)
 - #163380 (Tweak "name not found" resolution error when it happens from within a derive expansion)
 - #163538 (Add `rustc::missing_generic_type_visitable` lint)
 - #163617 (mips: make `Complex<T>` ABI match GCC)
 - #163772 (comptime fn error: suggest wrapping in const block)
 - #163813 (use pre-borrowck typing env for early MIR validation)
 - #163924 (replace instances of NonNull::new(&mut x).expect("...") with NonNull::from_mut)
 - #163958 (only make `RustaceansAreAwesome` satisfy trait clauses)
 - #163960 (vexos: clear .bss from assembly)
 - #163974 (Condense AdtDef lang item checks into one match)
 - #163979 (Add `bf16` to arm features)
 - #163989 (Revert "compiletest: stream output of executor process when --no-capture is set")
 - #163995 (m68k-unknown-none-elf: Remove code model)

Failed merges:

 - #163832 (reject non-async coroutine closures as async callables)
 - #163972 (const-eval: ICE when we hit a non-const fn)
@rust-bors rust-bors Bot 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 8, 2026
@rust-bors

This comment has been minimized.

programskillforverification pushed a commit to programskillforverification/miri that referenced this pull request Oct 9, 2026
…uwer

Rollup of 19 pull requests

Successful merges:

 - rust-lang/rust#156112 (Distinguish `repr(C)` ZSTs from others in ABI computation)
 - rust-lang/rust#157941 (Deny partial `-Z stack-protector` by default in all editions)
 - rust-lang/rust#163462 (Fix COFF renaming of decorated (stdcall/fastcall/vectorcall) exports)
 - rust-lang/rust#163855 (Include enclosing item's context on const errors)
 - rust-lang/rust#163861 (Run LLDB debuginfo tests on `x86_64-mingw`)
 - rust-lang/rust#163913 ( Silence redundant failed obligations on the same statement)
 - rust-lang/rust#161201 (Speed up tidy again)
 - rust-lang/rust#163380 (Tweak "name not found" resolution error when it happens from within a derive expansion)
 - rust-lang/rust#163538 (Add `rustc::missing_generic_type_visitable` lint)
 - rust-lang/rust#163617 (mips: make `Complex<T>` ABI match GCC)
 - rust-lang/rust#163772 (comptime fn error: suggest wrapping in const block)
 - rust-lang/rust#163813 (use pre-borrowck typing env for early MIR validation)
 - rust-lang/rust#163924 (replace instances of NonNull::new(&mut x).expect("...") with NonNull::from_mut)
 - rust-lang/rust#163958 (only make `RustaceansAreAwesome` satisfy trait clauses)
 - rust-lang/rust#163960 (vexos: clear .bss from assembly)
 - rust-lang/rust#163974 (Condense AdtDef lang item checks into one match)
 - rust-lang/rust#163979 (Add `bf16` to arm features)
 - rust-lang/rust#163989 (Revert "compiletest: stream output of executor process when --no-capture is set")
 - rust-lang/rust#163995 (m68k-unknown-none-elf: Remove code model)

Failed merges:

 - rust-lang/rust#163832 (reject non-async coroutine closures as async callables)
 - rust-lang/rust#163972 (const-eval: ICE when we hit a non-const fn)
Signed-off-by: Amirhossein Akhlaghpour <m9.akhlaghpoor@gmail.com>
@amirHdev
amirHdev force-pushed the reject-non-async-coroutine-closures branch from 824c4c0 to 23f86c5 Compare October 9, 2026 09:19
@rustbot

rustbot commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@amirHdev
amirHdev requested a review from oli-obk October 9, 2026 09:20
@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 Oct 9, 2026
@amirHdev

amirHdev commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

@oli-obk please have another look

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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lending iterators are busted with the new solver

5 participants