Closed
Description
The following code now emits a suggestion to add a type parameter (since #68447 in 1.42):
pub struct S {
pub f: Option<PathBuf>
}
Emits:
error[E0412]: cannot find type `PathBuf` in this scope
--> src/lib.rs:2:19
|
2 | pub f: Option<PathBuf>
| ^^^^^^^ not found in this scope
|
help: possible candidate is found in another module, you can import it into scope
|
1 | use std::path::PathBuf;
|
help: you might be missing a type parameter
|
1 | pub struct S<PathBuf> {
| ^^^^^^^^^
The suggestion to add <PathBuf>
is clearly wrong (in my eyes), and I feel like I am seeing this suggestion a lot.
Perhaps, if there is already a "possible candidate import" suggestion, it could skip the suggestion to add a type parameter? Or maybe some other heuristic to dial back how often it shows up?
(BTW, it is a great suggestion when it applies, but more often than not I'm getting a wrong hint.)