Skip to content

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

Closed

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."

Activity

  1. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Mar 9, 2017
  2. steveklabnik commented on Dec 25, 2019

    @steveklabnik
    Contributor

    Triage: I feel like this has gotten better in certain cases, but not all. It would be nice to make a way to reproduce this more easily, but it's non-trivial.

  3. added
    E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
    on Oct 20, 2023
  4. added
    S-needs-reproStatus: This issue has no reproduction and needs a reproduction to make progress.
    and removed
    E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
    on Feb 28, 2024
  5. added
    D-crate-version-mismatchDiagnostics: Errors or lints caused be the use of two different crate versions.
    on Apr 22, 2024
  6. added 2 commits that reference this issue on Aug 17, 2024
    02cf872
    665ef99
  7. added a commit that references this issue on Aug 17, 2024
    9b318d2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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