2020-12-22 19:25:37 +00:00
|
|
|
// Functions with a type placeholder `_` as the return type should
|
|
|
|
// show a function pointer suggestion when given a function item
|
|
|
|
// and suggest how to return closures correctly from a function.
|
|
|
|
// This is a regression test of #80179
|
|
|
|
|
|
|
|
fn returns_i32() -> i32 {
|
|
|
|
0
|
|
|
|
}
|
|
|
|
|
|
|
|
fn returns_fn_ptr() -> _ {
|
2022-01-05 10:43:21 +00:00
|
|
|
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types [E0121]
|
2020-12-22 19:25:37 +00:00
|
|
|
//~| NOTE not allowed in type signatures
|
|
|
|
//~| HELP replace with the correct return type
|
|
|
|
//~| SUGGESTION fn() -> i32
|
|
|
|
returns_i32
|
|
|
|
}
|
|
|
|
|
|
|
|
fn returns_closure() -> _ {
|
2022-01-05 10:43:21 +00:00
|
|
|
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types [E0121]
|
2020-12-22 19:25:37 +00:00
|
|
|
//~| NOTE not allowed in type signatures
|
2022-12-27 23:56:46 +00:00
|
|
|
//~| HELP replace with an appropriate return type
|
|
|
|
//~| SUGGESTION impl Fn() -> i32
|
2023-01-04 00:26:53 +00:00
|
|
|
//~| NOTE for more information on `Fn` traits and closure types
|
2020-12-22 19:25:37 +00:00
|
|
|
|| 0
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|