Skip to content

'expected struct cargo_metadata::Package, found a different struct cargo_metadata::Package' should note that one is a module and one is a crate #80255

Open
@jyn514

Description

@jyn514
error[E0308]: mismatched types
  --> src/utils/cargo_metadata.rs:50:9
   |
50 |         &self.root
   |         ^^^^^^^^^^ expected struct `cargo_metadata::Package`, found a different struct `cargo_metadata::Package`
   |
   = note: expected reference `&cargo_metadata::Package` (struct `cargo_metadata::Package`)
              found reference `&cargo_metadata::Package` (struct `cargo_metadata::Package`)

It's impossible to tell here whether it found the version from the current module, crate::utils::cargo_metadata, or the one from the crate, ::cargo_metadata. It would be nice to at least say why they might be different, the same way the compiler warns about two versions of a crate.

(I feel like I reported this bug already, but I can't seem to find it.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.D-confusingDiagnostics: Confusing error or lint that should be reworked.D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.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