-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.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
When an item has been named _ (notably, const _: () = (); is valid), we incorrectly include it as a valid import suggestion:
rust/tests/ui/resolve/underscore-bindings-disambiguators.stderr
Lines 1 to 17 in c043085
| error[E0432]: unresolved import `X` | |
| --> $DIR/underscore-bindings-disambiguators.rs:25:5 | |
| | | |
| LL | use X as Y; | |
| | -^^^^^ | |
| | | | |
| | no `X` in the root | |
| | help: a similar name exists in the module: `_` | |
| error[E0432]: unresolved import `Z` | |
| --> $DIR/underscore-bindings-disambiguators.rs:26:5 | |
| | | |
| LL | use Z as W; | |
| | -^^^^^ | |
| | | | |
| | no `Z` in the root | |
| | help: a similar name exists in the module: `_` |
use _ is never valid, so the suggestion shouldn't be emitted.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.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.