Skip to content

'ambiguous name' error message has weird wording #79717

Closed
@camelid

Description

@camelid
mod serde {}

use serde::foo;

(Playground)

Errors:

   Compiling playground v0.0.1 (/playground)
error[E0432]: unresolved import `serde::foo`
 --> src/lib.rs:3:5
  |
3 | use serde::foo;
  |     ^^^^^^^^^^ no `foo` in `serde`

error[E0659]: `serde` is ambiguous (name vs any other name during import resolution)
 --> src/lib.rs:3:5
  |
3 | use serde::foo;
  |     ^^^^^ ambiguous name
  |
  = note: `serde` could refer to a crate passed with `--extern`
  = help: use `::serde` to refer to this crate unambiguously
note: `serde` could also refer to the module defined here
 --> src/lib.rs:1:1
  |
1 | mod serde {}
  | ^^^^^^^^^^^^
  = help: use `crate::serde` to refer to this module unambiguously

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0432, E0659.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `playground`

To learn more, run the command again with --verbose.

The error message says:

serde is ambiguous (name vs any other name during import resolution)

But what does it mean by "name vs any other name during import resolution"? I think this should be reworded or even deleted – it doesn't seem to add anything.

Metadata

Metadata

Assignees

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.D-confusingDiagnostics: Confusing error or lint that should be reworked.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