summaryrefslogtreecommitdiffstats
path: root/tests/ui/fn
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/ui/fn-in-pat.rs (renamed from src/test/ui/fn-in-pat.rs)0
-rw-r--r--tests/ui/fn-in-pat.stderr (renamed from src/test/ui/fn-in-pat.stderr)0
-rw-r--r--tests/ui/fn/bad-main.rs (renamed from src/test/ui/fn/bad-main.rs)0
-rw-r--r--tests/ui/fn/bad-main.stderr (renamed from src/test/ui/fn/bad-main.stderr)0
-rw-r--r--tests/ui/fn/dyn-fn-alignment.rs (renamed from src/test/ui/fn/dyn-fn-alignment.rs)0
-rw-r--r--tests/ui/fn/expr-fn-panic.rs (renamed from src/test/ui/fn/expr-fn-panic.rs)0
-rw-r--r--tests/ui/fn/expr-fn.rs (renamed from src/test/ui/fn/expr-fn.rs)0
-rw-r--r--tests/ui/fn/fn-bad-block-type.rs (renamed from src/test/ui/fn/fn-bad-block-type.rs)0
-rw-r--r--tests/ui/fn/fn-bad-block-type.stderr (renamed from src/test/ui/fn/fn-bad-block-type.stderr)0
-rw-r--r--tests/ui/fn/fn-closure-mutable-capture.rs (renamed from src/test/ui/fn/fn-closure-mutable-capture.rs)0
-rw-r--r--tests/ui/fn/fn-closure-mutable-capture.stderr (renamed from src/test/ui/fn/fn-closure-mutable-capture.stderr)0
-rw-r--r--tests/ui/fn/fn-compare-mismatch.rs (renamed from src/test/ui/fn/fn-compare-mismatch.rs)0
-rw-r--r--tests/ui/fn/fn-compare-mismatch.stderr (renamed from src/test/ui/fn/fn-compare-mismatch.stderr)0
-rw-r--r--tests/ui/fn/fn-item-type.rs (renamed from src/test/ui/fn/fn-item-type.rs)0
-rw-r--r--tests/ui/fn/fn-item-type.stderr (renamed from src/test/ui/fn/fn-item-type.stderr)0
-rw-r--r--tests/ui/fn/fn-recover-return-sign.fixed (renamed from src/test/ui/fn/fn-recover-return-sign.fixed)0
-rw-r--r--tests/ui/fn/fn-recover-return-sign.rs (renamed from src/test/ui/fn/fn-recover-return-sign.rs)0
-rw-r--r--tests/ui/fn/fn-recover-return-sign.stderr (renamed from src/test/ui/fn/fn-recover-return-sign.stderr)0
-rw-r--r--tests/ui/fn/fn-recover-return-sign2.rs (renamed from src/test/ui/fn/fn-recover-return-sign2.rs)0
-rw-r--r--tests/ui/fn/fn-recover-return-sign2.stderr (renamed from src/test/ui/fn/fn-recover-return-sign2.stderr)0
-rw-r--r--tests/ui/fn/fn-trait-formatting.rs (renamed from src/test/ui/fn/fn-trait-formatting.rs)0
-rw-r--r--tests/ui/fn/fn-trait-formatting.stderr (renamed from src/test/ui/fn/fn-trait-formatting.stderr)0
-rw-r--r--tests/ui/fn/fun-call-variants.rs (renamed from src/test/ui/fn/fun-call-variants.rs)0
-rw-r--r--tests/ui/fn/implied-bounds-unnorm-associated-type-2.rs (renamed from src/test/ui/fn/implied-bounds-unnorm-associated-type-2.rs)0
-rw-r--r--tests/ui/fn/implied-bounds-unnorm-associated-type-2.stderr (renamed from src/test/ui/fn/implied-bounds-unnorm-associated-type-2.stderr)0
-rw-r--r--tests/ui/fn/implied-bounds-unnorm-associated-type-3.rs (renamed from src/test/ui/fn/implied-bounds-unnorm-associated-type-3.rs)0
-rw-r--r--tests/ui/fn/implied-bounds-unnorm-associated-type-4.rs (renamed from src/test/ui/fn/implied-bounds-unnorm-associated-type-4.rs)0
-rw-r--r--tests/ui/fn/implied-bounds-unnorm-associated-type-4.stderr (renamed from src/test/ui/fn/implied-bounds-unnorm-associated-type-4.stderr)0
-rw-r--r--tests/ui/fn/implied-bounds-unnorm-associated-type-5.rs (renamed from src/test/ui/fn/implied-bounds-unnorm-associated-type-5.rs)0
-rw-r--r--tests/ui/fn/implied-bounds-unnorm-associated-type-5.stderr (renamed from src/test/ui/fn/implied-bounds-unnorm-associated-type-5.stderr)0
-rw-r--r--tests/ui/fn/implied-bounds-unnorm-associated-type.rs (renamed from src/test/ui/fn/implied-bounds-unnorm-associated-type.rs)0
-rw-r--r--tests/ui/fn/implied-bounds-unnorm-associated-type.stderr (renamed from src/test/ui/fn/implied-bounds-unnorm-associated-type.stderr)0
-rw-r--r--tests/ui/fn/issue-3044.rs6
-rw-r--r--tests/ui/fn/issue-3044.stderr21
-rw-r--r--tests/ui/fn/issue-3904.rs (renamed from src/test/ui/issues/issue-3904.rs)0
-rw-r--r--tests/ui/fn/issue-80179.rs (renamed from src/test/ui/fn/issue-80179.rs)6
-rw-r--r--tests/ui/fn/issue-80179.stderr (renamed from src/test/ui/fn/issue-80179.stderr)6
-rw-r--r--tests/ui/fn/keyword-order.rs (renamed from src/test/ui/fn/keyword-order.rs)0
-rw-r--r--tests/ui/fn/keyword-order.stderr (renamed from src/test/ui/fn/keyword-order.stderr)0
-rw-r--r--tests/ui/fn/nested-function-names-issue-8587.rs (renamed from src/test/ui/fn/nested-function-names-issue-8587.rs)0
-rw-r--r--tests/ui/fn/signature-error-reporting-under-verbose.rs (renamed from src/test/ui/fn/signature-error-reporting-under-verbose.rs)0
-rw-r--r--tests/ui/fn/signature-error-reporting-under-verbose.stderr (renamed from src/test/ui/fn/signature-error-reporting-under-verbose.stderr)0
-rw-r--r--tests/ui/fn/suggest-return-closure.rs34
-rw-r--r--tests/ui/fn/suggest-return-closure.stderr36
-rw-r--r--tests/ui/fn/suggest-return-future.rs23
-rw-r--r--tests/ui/fn/suggest-return-future.stderr21
46 files changed, 148 insertions, 5 deletions
diff --git a/src/test/ui/fn-in-pat.rs b/tests/ui/fn-in-pat.rs
index 2d7c86b86..2d7c86b86 100644
--- a/src/test/ui/fn-in-pat.rs
+++ b/tests/ui/fn-in-pat.rs
diff --git a/src/test/ui/fn-in-pat.stderr b/tests/ui/fn-in-pat.stderr
index 2482d6326..2482d6326 100644
--- a/src/test/ui/fn-in-pat.stderr
+++ b/tests/ui/fn-in-pat.stderr
diff --git a/src/test/ui/fn/bad-main.rs b/tests/ui/fn/bad-main.rs
index 751159961..751159961 100644
--- a/src/test/ui/fn/bad-main.rs
+++ b/tests/ui/fn/bad-main.rs
diff --git a/src/test/ui/fn/bad-main.stderr b/tests/ui/fn/bad-main.stderr
index 675b66d05..675b66d05 100644
--- a/src/test/ui/fn/bad-main.stderr
+++ b/tests/ui/fn/bad-main.stderr
diff --git a/src/test/ui/fn/dyn-fn-alignment.rs b/tests/ui/fn/dyn-fn-alignment.rs
index cedfd1cf2..cedfd1cf2 100644
--- a/src/test/ui/fn/dyn-fn-alignment.rs
+++ b/tests/ui/fn/dyn-fn-alignment.rs
diff --git a/src/test/ui/fn/expr-fn-panic.rs b/tests/ui/fn/expr-fn-panic.rs
index 123b57f97..123b57f97 100644
--- a/src/test/ui/fn/expr-fn-panic.rs
+++ b/tests/ui/fn/expr-fn-panic.rs
diff --git a/src/test/ui/fn/expr-fn.rs b/tests/ui/fn/expr-fn.rs
index 253cbfd5d..253cbfd5d 100644
--- a/src/test/ui/fn/expr-fn.rs
+++ b/tests/ui/fn/expr-fn.rs
diff --git a/src/test/ui/fn/fn-bad-block-type.rs b/tests/ui/fn/fn-bad-block-type.rs
index 01dcff058..01dcff058 100644
--- a/src/test/ui/fn/fn-bad-block-type.rs
+++ b/tests/ui/fn/fn-bad-block-type.rs
diff --git a/src/test/ui/fn/fn-bad-block-type.stderr b/tests/ui/fn/fn-bad-block-type.stderr
index 13ebfd1e2..13ebfd1e2 100644
--- a/src/test/ui/fn/fn-bad-block-type.stderr
+++ b/tests/ui/fn/fn-bad-block-type.stderr
diff --git a/src/test/ui/fn/fn-closure-mutable-capture.rs b/tests/ui/fn/fn-closure-mutable-capture.rs
index 97141886f..97141886f 100644
--- a/src/test/ui/fn/fn-closure-mutable-capture.rs
+++ b/tests/ui/fn/fn-closure-mutable-capture.rs
diff --git a/src/test/ui/fn/fn-closure-mutable-capture.stderr b/tests/ui/fn/fn-closure-mutable-capture.stderr
index 03e3d545a..03e3d545a 100644
--- a/src/test/ui/fn/fn-closure-mutable-capture.stderr
+++ b/tests/ui/fn/fn-closure-mutable-capture.stderr
diff --git a/src/test/ui/fn/fn-compare-mismatch.rs b/tests/ui/fn/fn-compare-mismatch.rs
index d734d54e8..d734d54e8 100644
--- a/src/test/ui/fn/fn-compare-mismatch.rs
+++ b/tests/ui/fn/fn-compare-mismatch.rs
diff --git a/src/test/ui/fn/fn-compare-mismatch.stderr b/tests/ui/fn/fn-compare-mismatch.stderr
index df838cb11..df838cb11 100644
--- a/src/test/ui/fn/fn-compare-mismatch.stderr
+++ b/tests/ui/fn/fn-compare-mismatch.stderr
diff --git a/src/test/ui/fn/fn-item-type.rs b/tests/ui/fn/fn-item-type.rs
index 1831e6cbf..1831e6cbf 100644
--- a/src/test/ui/fn/fn-item-type.rs
+++ b/tests/ui/fn/fn-item-type.rs
diff --git a/src/test/ui/fn/fn-item-type.stderr b/tests/ui/fn/fn-item-type.stderr
index f03a47d5c..f03a47d5c 100644
--- a/src/test/ui/fn/fn-item-type.stderr
+++ b/tests/ui/fn/fn-item-type.stderr
diff --git a/src/test/ui/fn/fn-recover-return-sign.fixed b/tests/ui/fn/fn-recover-return-sign.fixed
index 076be6a35..076be6a35 100644
--- a/src/test/ui/fn/fn-recover-return-sign.fixed
+++ b/tests/ui/fn/fn-recover-return-sign.fixed
diff --git a/src/test/ui/fn/fn-recover-return-sign.rs b/tests/ui/fn/fn-recover-return-sign.rs
index 0656023c0..0656023c0 100644
--- a/src/test/ui/fn/fn-recover-return-sign.rs
+++ b/tests/ui/fn/fn-recover-return-sign.rs
diff --git a/src/test/ui/fn/fn-recover-return-sign.stderr b/tests/ui/fn/fn-recover-return-sign.stderr
index 983109730..983109730 100644
--- a/src/test/ui/fn/fn-recover-return-sign.stderr
+++ b/tests/ui/fn/fn-recover-return-sign.stderr
diff --git a/src/test/ui/fn/fn-recover-return-sign2.rs b/tests/ui/fn/fn-recover-return-sign2.rs
index 31f56565c..31f56565c 100644
--- a/src/test/ui/fn/fn-recover-return-sign2.rs
+++ b/tests/ui/fn/fn-recover-return-sign2.rs
diff --git a/src/test/ui/fn/fn-recover-return-sign2.stderr b/tests/ui/fn/fn-recover-return-sign2.stderr
index 25ee8dd0c..25ee8dd0c 100644
--- a/src/test/ui/fn/fn-recover-return-sign2.stderr
+++ b/tests/ui/fn/fn-recover-return-sign2.stderr
diff --git a/src/test/ui/fn/fn-trait-formatting.rs b/tests/ui/fn/fn-trait-formatting.rs
index 636ac7107..636ac7107 100644
--- a/src/test/ui/fn/fn-trait-formatting.rs
+++ b/tests/ui/fn/fn-trait-formatting.rs
diff --git a/src/test/ui/fn/fn-trait-formatting.stderr b/tests/ui/fn/fn-trait-formatting.stderr
index 2a674d3c1..2a674d3c1 100644
--- a/src/test/ui/fn/fn-trait-formatting.stderr
+++ b/tests/ui/fn/fn-trait-formatting.stderr
diff --git a/src/test/ui/fn/fun-call-variants.rs b/tests/ui/fn/fun-call-variants.rs
index 5b83e2620..5b83e2620 100644
--- a/src/test/ui/fn/fun-call-variants.rs
+++ b/tests/ui/fn/fun-call-variants.rs
diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type-2.rs b/tests/ui/fn/implied-bounds-unnorm-associated-type-2.rs
index 5d9245556..5d9245556 100644
--- a/src/test/ui/fn/implied-bounds-unnorm-associated-type-2.rs
+++ b/tests/ui/fn/implied-bounds-unnorm-associated-type-2.rs
diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type-2.stderr b/tests/ui/fn/implied-bounds-unnorm-associated-type-2.stderr
index 0c3df04ea..0c3df04ea 100644
--- a/src/test/ui/fn/implied-bounds-unnorm-associated-type-2.stderr
+++ b/tests/ui/fn/implied-bounds-unnorm-associated-type-2.stderr
diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type-3.rs b/tests/ui/fn/implied-bounds-unnorm-associated-type-3.rs
index 888f74cf6..888f74cf6 100644
--- a/src/test/ui/fn/implied-bounds-unnorm-associated-type-3.rs
+++ b/tests/ui/fn/implied-bounds-unnorm-associated-type-3.rs
diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type-4.rs b/tests/ui/fn/implied-bounds-unnorm-associated-type-4.rs
index 12859252c..12859252c 100644
--- a/src/test/ui/fn/implied-bounds-unnorm-associated-type-4.rs
+++ b/tests/ui/fn/implied-bounds-unnorm-associated-type-4.rs
diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type-4.stderr b/tests/ui/fn/implied-bounds-unnorm-associated-type-4.stderr
index fcbaa91d1..fcbaa91d1 100644
--- a/src/test/ui/fn/implied-bounds-unnorm-associated-type-4.stderr
+++ b/tests/ui/fn/implied-bounds-unnorm-associated-type-4.stderr
diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type-5.rs b/tests/ui/fn/implied-bounds-unnorm-associated-type-5.rs
index 2a9a6a8cc..2a9a6a8cc 100644
--- a/src/test/ui/fn/implied-bounds-unnorm-associated-type-5.rs
+++ b/tests/ui/fn/implied-bounds-unnorm-associated-type-5.rs
diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type-5.stderr b/tests/ui/fn/implied-bounds-unnorm-associated-type-5.stderr
index 458756a3d..458756a3d 100644
--- a/src/test/ui/fn/implied-bounds-unnorm-associated-type-5.stderr
+++ b/tests/ui/fn/implied-bounds-unnorm-associated-type-5.stderr
diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type.rs b/tests/ui/fn/implied-bounds-unnorm-associated-type.rs
index d58d25036..d58d25036 100644
--- a/src/test/ui/fn/implied-bounds-unnorm-associated-type.rs
+++ b/tests/ui/fn/implied-bounds-unnorm-associated-type.rs
diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type.stderr b/tests/ui/fn/implied-bounds-unnorm-associated-type.stderr
index e35f46e44..e35f46e44 100644
--- a/src/test/ui/fn/implied-bounds-unnorm-associated-type.stderr
+++ b/tests/ui/fn/implied-bounds-unnorm-associated-type.stderr
diff --git a/tests/ui/fn/issue-3044.rs b/tests/ui/fn/issue-3044.rs
new file mode 100644
index 000000000..19bee733e
--- /dev/null
+++ b/tests/ui/fn/issue-3044.rs
@@ -0,0 +1,6 @@
+fn main() {
+ let needlesArr: Vec<char> = vec!['a', 'f'];
+ needlesArr.iter().fold(|x, y| {
+ //~^ ERROR this method takes 2 arguments but 1 argument was supplied
+ });
+}
diff --git a/tests/ui/fn/issue-3044.stderr b/tests/ui/fn/issue-3044.stderr
new file mode 100644
index 000000000..2690ad711
--- /dev/null
+++ b/tests/ui/fn/issue-3044.stderr
@@ -0,0 +1,21 @@
+error[E0061]: this method takes 2 arguments but 1 argument was supplied
+ --> $DIR/issue-3044.rs:3:23
+ |
+LL | needlesArr.iter().fold(|x, y| {
+ | _______________________^^^^-
+LL | |
+LL | | });
+ | |______- an argument is missing
+ |
+note: associated function defined here
+ --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+help: provide the argument
+ |
+LL ~ needlesArr.iter().fold(|x, y| {
+LL +
+LL ~ }, /* f */);
+ |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0061`.
diff --git a/src/test/ui/issues/issue-3904.rs b/tests/ui/fn/issue-3904.rs
index 7beb91a28..7beb91a28 100644
--- a/src/test/ui/issues/issue-3904.rs
+++ b/tests/ui/fn/issue-3904.rs
diff --git a/src/test/ui/fn/issue-80179.rs b/tests/ui/fn/issue-80179.rs
index fcef6f1b6..35e39bebb 100644
--- a/src/test/ui/fn/issue-80179.rs
+++ b/tests/ui/fn/issue-80179.rs
@@ -18,9 +18,9 @@ fn returns_fn_ptr() -> _ {
fn returns_closure() -> _ {
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types [E0121]
//~| NOTE not allowed in type signatures
-//~| HELP consider using an `Fn`, `FnMut`, or `FnOnce` trait bound
-//~| NOTE for more information on `Fn` traits and closure types, see
-// https://doc.rust-lang.org/book/ch13-01-closures.html
+//~| HELP replace with an appropriate return type
+//~| SUGGESTION impl Fn() -> i32
+//~| NOTE for more information on `Fn` traits and closure types
|| 0
}
diff --git a/src/test/ui/fn/issue-80179.stderr b/tests/ui/fn/issue-80179.stderr
index 2ca4ae982..f5d6c44db 100644
--- a/src/test/ui/fn/issue-80179.stderr
+++ b/tests/ui/fn/issue-80179.stderr
@@ -11,9 +11,11 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures
--> $DIR/issue-80179.rs:18:25
|
LL | fn returns_closure() -> _ {
- | ^ not allowed in type signatures
+ | ^
+ | |
+ | not allowed in type signatures
+ | help: replace with an appropriate return type: `impl Fn() -> i32`
|
- = help: consider using an `Fn`, `FnMut`, or `FnOnce` trait bound
= note: for more information on `Fn` traits and closure types, see https://doc.rust-lang.org/book/ch13-01-closures.html
error: aborting due to 2 previous errors
diff --git a/src/test/ui/fn/keyword-order.rs b/tests/ui/fn/keyword-order.rs
index 8a21db673..8a21db673 100644
--- a/src/test/ui/fn/keyword-order.rs
+++ b/tests/ui/fn/keyword-order.rs
diff --git a/src/test/ui/fn/keyword-order.stderr b/tests/ui/fn/keyword-order.stderr
index d3b140c85..d3b140c85 100644
--- a/src/test/ui/fn/keyword-order.stderr
+++ b/tests/ui/fn/keyword-order.stderr
diff --git a/src/test/ui/fn/nested-function-names-issue-8587.rs b/tests/ui/fn/nested-function-names-issue-8587.rs
index 8fafd41d9..8fafd41d9 100644
--- a/src/test/ui/fn/nested-function-names-issue-8587.rs
+++ b/tests/ui/fn/nested-function-names-issue-8587.rs
diff --git a/src/test/ui/fn/signature-error-reporting-under-verbose.rs b/tests/ui/fn/signature-error-reporting-under-verbose.rs
index d7a8c95e8..d7a8c95e8 100644
--- a/src/test/ui/fn/signature-error-reporting-under-verbose.rs
+++ b/tests/ui/fn/signature-error-reporting-under-verbose.rs
diff --git a/src/test/ui/fn/signature-error-reporting-under-verbose.stderr b/tests/ui/fn/signature-error-reporting-under-verbose.stderr
index 6260fc8dc..6260fc8dc 100644
--- a/src/test/ui/fn/signature-error-reporting-under-verbose.stderr
+++ b/tests/ui/fn/signature-error-reporting-under-verbose.stderr
diff --git a/tests/ui/fn/suggest-return-closure.rs b/tests/ui/fn/suggest-return-closure.rs
new file mode 100644
index 000000000..33daa1ea0
--- /dev/null
+++ b/tests/ui/fn/suggest-return-closure.rs
@@ -0,0 +1,34 @@
+fn fn_once() -> _ {
+ //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types [E0121]
+ //~| NOTE not allowed in type signatures
+ //~| HELP replace with an appropriate return type
+ //~| SUGGESTION impl FnOnce()
+ //~| NOTE for more information on `Fn` traits and closure types
+ let x = String::new();
+ || {
+ drop(x);
+ }
+}
+
+fn fn_mut() -> _ {
+ //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types [E0121]
+ //~| NOTE not allowed in type signatures
+ //~| HELP replace with an appropriate return type
+ //~| SUGGESTION impl FnMut(char)
+ //~| NOTE for more information on `Fn` traits and closure types
+ let x = String::new();
+ |c| {
+ x.push(c);
+ }
+}
+
+fn fun() -> _ {
+ //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types [E0121]
+ //~| NOTE not allowed in type signatures
+ //~| HELP replace with an appropriate return type
+ //~| SUGGESTION impl Fn() -> i32
+ //~| NOTE for more information on `Fn` traits and closure types
+ || 1i32
+}
+
+fn main() {}
diff --git a/tests/ui/fn/suggest-return-closure.stderr b/tests/ui/fn/suggest-return-closure.stderr
new file mode 100644
index 000000000..341044469
--- /dev/null
+++ b/tests/ui/fn/suggest-return-closure.stderr
@@ -0,0 +1,36 @@
+error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
+ --> $DIR/suggest-return-closure.rs:1:17
+ |
+LL | fn fn_once() -> _ {
+ | ^
+ | |
+ | not allowed in type signatures
+ | help: replace with an appropriate return type: `impl FnOnce()`
+ |
+ = note: for more information on `Fn` traits and closure types, see https://doc.rust-lang.org/book/ch13-01-closures.html
+
+error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
+ --> $DIR/suggest-return-closure.rs:13:16
+ |
+LL | fn fn_mut() -> _ {
+ | ^
+ | |
+ | not allowed in type signatures
+ | help: replace with an appropriate return type: `impl FnMut(char)`
+ |
+ = note: for more information on `Fn` traits and closure types, see https://doc.rust-lang.org/book/ch13-01-closures.html
+
+error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
+ --> $DIR/suggest-return-closure.rs:25:13
+ |
+LL | fn fun() -> _ {
+ | ^
+ | |
+ | not allowed in type signatures
+ | help: replace with an appropriate return type: `impl Fn() -> i32`
+ |
+ = note: for more information on `Fn` traits and closure types, see https://doc.rust-lang.org/book/ch13-01-closures.html
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0121`.
diff --git a/tests/ui/fn/suggest-return-future.rs b/tests/ui/fn/suggest-return-future.rs
new file mode 100644
index 000000000..750740d94
--- /dev/null
+++ b/tests/ui/fn/suggest-return-future.rs
@@ -0,0 +1,23 @@
+// edition: 2021
+
+async fn a() -> i32 {
+ 0
+}
+
+fn foo() -> _ {
+ //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types [E0121]
+ //~| NOTE not allowed in type signatures
+ //~| HELP replace with an appropriate return type
+ //~| SUGGESTION impl Future<Output = i32>
+ a()
+}
+
+fn bar() -> _ {
+ //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types [E0121]
+ //~| NOTE not allowed in type signatures
+ //~| HELP replace with an appropriate return type
+ //~| SUGGESTION impl Future<Output = i32>
+ async { a().await }
+}
+
+fn main() {}
diff --git a/tests/ui/fn/suggest-return-future.stderr b/tests/ui/fn/suggest-return-future.stderr
new file mode 100644
index 000000000..a4c8b5d8c
--- /dev/null
+++ b/tests/ui/fn/suggest-return-future.stderr
@@ -0,0 +1,21 @@
+error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
+ --> $DIR/suggest-return-future.rs:7:13
+ |
+LL | fn foo() -> _ {
+ | ^
+ | |
+ | not allowed in type signatures
+ | help: replace with an appropriate return type: `impl Future<Output = i32>`
+
+error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
+ --> $DIR/suggest-return-future.rs:15:13
+ |
+LL | fn bar() -> _ {
+ | ^
+ | |
+ | not allowed in type signatures
+ | help: replace with an appropriate return type: `impl Future<Output = i32>`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0121`.