Closed
Description
Given the following code: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=91ba3d382d71310c4e6239fc5d4da92f
struct Foo;
impl From<Vec<Vec<Vec<i32>>>> for Foo {
fn from(x: _) -> Self { Self }
}
The current output is:
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
--> src/lib.rs:4:16
|
4 | fn from(x: _) -> Self { Self }
| ^ not allowed in type signatures
|
help: use type parameters instead
|
4 | fn from<T>(x: T) -> Self { Self }
| +++ ~
That's a particularly-bad help
in a trait impl, since the associated function is not generic, and thus adding a generic parameter definitely won't work.
Ideally the output should look like:
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
--> src/lib.rs:4:16
|
4 | fn from(x: _) -> Self { Self }
| ^ not allowed in type signatures
|
help: use the type required by the trait instead
|
4 | fn from(x: Vec<Vec<Vec<i32>>>) -> Self { Self }
| ~~~~~~~~~~~~~~~~~~
So that, like happens with -> _
, I can just accept the structured suggestion instead of needing to type out the long type again.