- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Closed
Labels
A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-bugCategory: This is a bug.Category: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.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
For example (playground):
const _: () = ();
fn main() {
    a
}Errors with:
error[E0425]: cannot find value `a` in this scope
 --> src/main.rs:4:5
  |
1 | const _: () = ();
  | ----------------- similarly named constant `_` defined here
...
4 |     a
  |     ^ help: a constant with a similar name exists: `_`
The same also happens with use Trait as _ (playground):
pub use Iterator as _;
fn foo<T: A>(x: T) {}error[E0405]: cannot find trait `A` in this scope
    --> src/lib.rs:3:11
     |
3    |   fn foo<T: A>(x: T) {}
     |             ^ help: a trait with a similar name exists: `_`
The diagnostics shouldn't suggest things named underscore.
Metadata
Metadata
Assignees
Labels
A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-bugCategory: This is a bug.Category: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.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.