-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
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.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.