diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs
index 6e62e50d3af82..190b57ecea4d0 100644
--- a/compiler/rustc_hir_analysis/src/collect.rs
+++ b/compiler/rustc_hir_analysis/src/collect.rs
@@ -1263,6 +1263,21 @@ pub fn suggest_impl_trait<'tcx>(
infcx.tcx.lang_items().future_output(),
format_as_assoc,
),
+ (
+ infcx.tcx.lang_items().async_fn_trait(),
+ infcx.tcx.lang_items().async_fn_once_output(),
+ format_as_parenthesized,
+ ),
+ (
+ infcx.tcx.lang_items().async_fn_mut_trait(),
+ infcx.tcx.lang_items().async_fn_once_output(),
+ format_as_parenthesized,
+ ),
+ (
+ infcx.tcx.lang_items().async_fn_once_trait(),
+ infcx.tcx.lang_items().async_fn_once_output(),
+ format_as_parenthesized,
+ ),
(
infcx.tcx.lang_items().fn_trait(),
infcx.tcx.lang_items().fn_once_output(),
diff --git a/tests/ui/async-await/async-closures/ice-async-closure-variance-issue-148488.stderr b/tests/ui/async-await/async-closures/ice-async-closure-variance-issue-148488.stderr
index ca98d210579f3..507b1e895898d 100644
--- a/tests/ui/async-await/async-closures/ice-async-closure-variance-issue-148488.stderr
+++ b/tests/ui/async-await/async-closures/ice-async-closure-variance-issue-148488.stderr
@@ -11,6 +11,12 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures
|
LL | fn ord() -> _ {
| ^ not allowed in type signatures
+ |
+help: replace with an appropriate return type
+ |
+LL - fn ord() -> _ {
+LL + fn ord() -> impl AsyncFn() {
+ |
error[E0392]: lifetime parameter `'g` is never used
--> $DIR/ice-async-closure-variance-issue-148488.rs:3:10
diff --git a/tests/ui/async-await/async-closures/suggest-impl-async-fn-issue-148493.fixed b/tests/ui/async-await/async-closures/suggest-impl-async-fn-issue-148493.fixed
new file mode 100644
index 0000000000000..db5091f6b7f6c
--- /dev/null
+++ b/tests/ui/async-await/async-closures/suggest-impl-async-fn-issue-148493.fixed
@@ -0,0 +1,64 @@
+#![allow(dead_code)]
+//@ run-rustfix
+//@ edition: 2021
+
+// The suggestion should be `impl AsyncFn()` instead of something like `{async closure@...}`
+
+fn test1() -> impl AsyncFn() {
+ //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types
+ //~| HELP replace with an appropriate return type
+ //~| SUGGESTION impl AsyncFn()
+ async || {}
+}
+
+fn test2() -> impl AsyncFn(i32) -> i32 {
+ //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types
+ //~| HELP replace with an appropriate return type
+ //~| SUGGESTION impl AsyncFn(i32) -> i32
+ async |x: i32| x + 1
+}
+
+fn test3() -> impl AsyncFn(i32, i32) -> i32 {
+ //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types
+ //~| HELP replace with an appropriate return type
+ //~| SUGGESTION impl AsyncFn(i32, i32) -> i32
+ async |x: i32, y: i32| x + y
+}
+
+fn test4() -> impl AsyncFn() {
+ //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types
+ //~| HELP replace with an appropriate return type
+ //~| SUGGESTION impl AsyncFn()
+ async || -> () { () }
+}
+
+fn test5() -> impl AsyncFn() -> i32 {
+ //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types
+ //~| HELP replace with an appropriate return type
+ //~| SUGGESTION impl AsyncFn() -> i32
+ let z = 42;
+ async move || z
+}
+
+fn test6() -> impl AsyncFnMut() -> i32 {
+ //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types
+ //~| HELP replace with an appropriate return type
+ //~| SUGGESTION impl AsyncFnMut() -> i32
+ let mut x = 0;
+ async move || {
+ x += 1;
+ x
+ }
+}
+
+fn test7() -> impl AsyncFnOnce() {
+ //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types
+ //~| HELP replace with an appropriate return type
+ //~| SUGGESTION impl AsyncFnOnce()
+ let s = String::from("hello");
+ async move || {
+ drop(s);
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/async-await/async-closures/suggest-impl-async-fn-issue-148493.rs b/tests/ui/async-await/async-closures/suggest-impl-async-fn-issue-148493.rs
new file mode 100644
index 0000000000000..1109904398dab
--- /dev/null
+++ b/tests/ui/async-await/async-closures/suggest-impl-async-fn-issue-148493.rs
@@ -0,0 +1,64 @@
+#![allow(dead_code)]
+//@ run-rustfix
+//@ edition: 2021
+
+// The suggestion should be `impl AsyncFn()` instead of something like `{async closure@...}`
+
+fn test1() -> _ {
+ //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types
+ //~| HELP replace with an appropriate return type
+ //~| SUGGESTION impl AsyncFn()
+ async || {}
+}
+
+fn test2() -> _ {
+ //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types
+ //~| HELP replace with an appropriate return type
+ //~| SUGGESTION impl AsyncFn(i32) -> i32
+ async |x: i32| x + 1
+}
+
+fn test3() -> _ {
+ //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types
+ //~| HELP replace with an appropriate return type
+ //~| SUGGESTION impl AsyncFn(i32, i32) -> i32
+ async |x: i32, y: i32| x + y
+}
+
+fn test4() -> _ {
+ //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types
+ //~| HELP replace with an appropriate return type
+ //~| SUGGESTION impl AsyncFn()
+ async || -> () { () }
+}
+
+fn test5() -> _ {
+ //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types
+ //~| HELP replace with an appropriate return type
+ //~| SUGGESTION impl AsyncFn() -> i32
+ let z = 42;
+ async move || z
+}
+
+fn test6() -> _ {
+ //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types
+ //~| HELP replace with an appropriate return type
+ //~| SUGGESTION impl AsyncFnMut() -> i32
+ let mut x = 0;
+ async move || {
+ x += 1;
+ x
+ }
+}
+
+fn test7() -> _ {
+ //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types
+ //~| HELP replace with an appropriate return type
+ //~| SUGGESTION impl AsyncFnOnce()
+ let s = String::from("hello");
+ async move || {
+ drop(s);
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/async-await/async-closures/suggest-impl-async-fn-issue-148493.stderr b/tests/ui/async-await/async-closures/suggest-impl-async-fn-issue-148493.stderr
new file mode 100644
index 0000000000000..abe775cec082b
--- /dev/null
+++ b/tests/ui/async-await/async-closures/suggest-impl-async-fn-issue-148493.stderr
@@ -0,0 +1,87 @@
+error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
+ --> $DIR/suggest-impl-async-fn-issue-148493.rs:7:15
+ |
+LL | fn test1() -> _ {
+ | ^ not allowed in type signatures
+ |
+help: replace with an appropriate return type
+ |
+LL - fn test1() -> _ {
+LL + fn test1() -> impl AsyncFn() {
+ |
+
+error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
+ --> $DIR/suggest-impl-async-fn-issue-148493.rs:14:15
+ |
+LL | fn test2() -> _ {
+ | ^ not allowed in type signatures
+ |
+help: replace with an appropriate return type
+ |
+LL - fn test2() -> _ {
+LL + fn test2() -> impl AsyncFn(i32) -> i32 {
+ |
+
+error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
+ --> $DIR/suggest-impl-async-fn-issue-148493.rs:21:15
+ |
+LL | fn test3() -> _ {
+ | ^ not allowed in type signatures
+ |
+help: replace with an appropriate return type
+ |
+LL - fn test3() -> _ {
+LL + fn test3() -> impl AsyncFn(i32, i32) -> i32 {
+ |
+
+error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
+ --> $DIR/suggest-impl-async-fn-issue-148493.rs:28:15
+ |
+LL | fn test4() -> _ {
+ | ^ not allowed in type signatures
+ |
+help: replace with an appropriate return type
+ |
+LL - fn test4() -> _ {
+LL + fn test4() -> impl AsyncFn() {
+ |
+
+error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
+ --> $DIR/suggest-impl-async-fn-issue-148493.rs:35:15
+ |
+LL | fn test5() -> _ {
+ | ^ not allowed in type signatures
+ |
+help: replace with an appropriate return type
+ |
+LL - fn test5() -> _ {
+LL + fn test5() -> impl AsyncFn() -> i32 {
+ |
+
+error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
+ --> $DIR/suggest-impl-async-fn-issue-148493.rs:43:15
+ |
+LL | fn test6() -> _ {
+ | ^ not allowed in type signatures
+ |
+help: replace with an appropriate return type
+ |
+LL - fn test6() -> _ {
+LL + fn test6() -> impl AsyncFnMut() -> i32 {
+ |
+
+error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
+ --> $DIR/suggest-impl-async-fn-issue-148493.rs:54:15
+ |
+LL | fn test7() -> _ {
+ | ^ not allowed in type signatures
+ |
+help: replace with an appropriate return type
+ |
+LL - fn test7() -> _ {
+LL + fn test7() -> impl AsyncFnOnce() {
+ |
+
+error: aborting due to 7 previous errors
+
+For more information about this error, try `rustc --explain E0121`.