Skip to content

Misleading message: "error: the trait Foo is not implemented for the type Bar" #32611

Closed
@Yoric

Description

@Yoric

Consider three crates High, Mid and Low, where:

  • Mid depends on Low;
  • High depends on both Mid and Low.

This is a quite common case.

Now, it sometimes happens that the dependency of Mid is bumped to a more recent version of Low. If, however, the developer fails to bump the dependency of High to a more recent version of Low, surprising error messages arise.

In particular,

"error: the trait `Foo` is not implemented for the type `Bar`"

may arise, without any change to the code of either Foo or Bar.

It would be great if the compiler could detect the error and somehow print something along the liens of

"error: using conflicting versions of the trait `Foo` for type `Bar`. You are probably using two distinct versions of the same library."

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-crate-version-mismatchDiagnostics: Errors or lints caused be the use of two different crate versions.S-needs-reproStatus: This issue has no reproduction and needs a reproduction to make progress.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