Skip to content

Fix FnMut::call_mut/Fn::call shim for async closures that capture references #127136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Make all tests in async dir build-pass, adjust implements-fnmut test …
…to begin ICEing during codegen
  • Loading branch information
compiler-errors committed Jun 29, 2024
commit 294436d27371d77967c77d93e31a34362f7c3cd0
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ edition: 2021
//@ check-pass
//@ build-pass
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//@ aux-build:block-on.rs
//@ edition:2021
//@ check-pass
//@ build-pass

#![feature(async_closure)]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//@ aux-build:block-on.rs
//@ edition:2021
//@ check-pass
//@ build-pass

#![feature(async_closure)]

Expand Down
10 changes: 7 additions & 3 deletions tests/ui/async-await/async-closures/implements-fnmut.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@ check-pass
//@ build-pass
//@ edition: 2021

// Demonstrates that an async closure may implement `FnMut` (not just `async FnMut`!)
Expand All @@ -9,9 +9,13 @@

#![feature(async_closure)]

fn main() {}
fn main() {
hello(&Ty);
}

fn needs_fn_mut<T>(x: impl FnMut() -> T) {}
fn needs_fn_mut<T>(mut x: impl FnMut() -> T) {
x();
}

fn hello(x: &Ty) {
needs_fn_mut(async || { x.hello(); });
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/async-await/async-closures/signature-deduction.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@ check-pass
//@ build-pass
//@ edition: 2021

#![feature(async_closure)]
Expand Down