Open
Description
Code
use crate::a::B;
mod a {
pub trait B {}
}
struct C<B: B>(B);
Current output
error[E0404]: expected trait, found type parameter `B`
--> src/lib.rs:7:13
|
1 | use crate::a::B;
| - you might have meant to refer to this trait
...
7 | struct C<B: B>(B);
| - ^ not a trait
| |
| found this type parameter
|
help: consider importing this trait instead
|
1 | use crate::a::B;
|
Desired output
error[E0404]: expected trait, found type parameter `B`
--> src/lib.rs:7:13
|
1 | use crate::a::B;
| - you might have meant to refer to this trait
...
7 | struct C<B: B>(B);
| - ^ not a trait
| |
| found this type parameter
|
Rationale and extra context
The import is already there. Ideally it should tell you that the import is being shadowed by the generic, but barring that, it definitely shouldn’t suggest adding a useless line of code that already exists and only creates more errors.
Other cases
No response
Anything else?
This happens on stable and nightly.