1 // Functions with a type placeholder `_` as the return type should
2 // show a function pointer suggestion when given a function item
3 // and suggest how to return closures correctly from a function.
4 // This is a regression test of #80179
6 fn returns_i32() -> i32 {
10 fn returns_fn_ptr() -> _ {
11 //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types [E0121]
12 //~| NOTE not allowed in type signatures
13 //~| HELP replace with the correct return type
14 //~| SUGGESTION fn() -> i32
18 fn returns_closure() -> _ {
19 //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types [E0121]
20 //~| NOTE not allowed in type signatures
21 //~| HELP consider using an `Fn`, `FnMut`, or `FnOnce` trait bound
22 //~| NOTE for more information on `Fn` traits and closure types, see
23 // https://doc.rust-lang.org/book/ch13-01-closures.html