Skip to content

Don't suggest to use things which weren't found either. #38054

Closed
@leoschwarz

Description

@leoschwarz

Sometimes it is very useful when rustc figures out that the faulty module use you just made is probably just a typo and directs you a potential match (thanks for that!). However it also directs you to potential matches which haven't been found either in certain cases, for example compiling

use DoesntExist1;
use DoesntExist2;

currently (2016-11-28) yields with both stable and nightly the following output:

error[E0432]: unresolved import `DoesntExist1`
 --> src/lib.rs:1:5
  |
1 | use DoesntExist1;
  |     ^^^^^^^^^^^^ no `DoesntExist1` in the root

error[E0432]: unresolved import `DoesntExist2`
 --> src/lib.rs:2:5
  |
2 | use DoesntExist2;
  |     ^^^^^^^^^^^^ no `DoesntExist2` in the root. Did you mean to use `DoesntExist1`?

While this is merely a suggestion displayed and shouldn't cause any harm at all maybe it might still be worth to check if what is suggested was actually found in the current scope. Or would that be too expensive (e.g. overhead in tracking what was already successfully imported and what not) and is thus left as is by design?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-resolveArea: Name/path resolution done by `rustc_resolve` specificallyE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions