Skip to content

Typo'd Imports Result in Confusing Error Message #76208

Open
@jackie-scholl

Description

@jackie-scholl

I wanted to use the chrono crate, so I added it to Cargo.toml and put an import at the top of main.rs: use chono::prelude::*, where I typo`d chrono as chono. I got this error message:

error[E0433]: failed to resolve: use of undeclared type or module `chono`
 --> src/main.rs:2:5
  |
2 | use chono::prelude::*;
  |     ^^^^^ use of undeclared type or module `chono`

I didn't see the typo, and I was confused because I thought I must have put the import in the wrong place, because it said I hadn't declared the module that I was declaring on that line. I checked the docs for E0433, and in the example given someone had forgotten to import the module at all, so I was surprised to see that error on an import line.

Meta

rustc --version --verbose:

rustc 1.45.0
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.45.0
LLVM version: 10.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-resolveArea: Name/path resolution done by `rustc_resolve` specificallyC-enhancementCategory: 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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions