Skip to content

Please improve the error message when there is a clash between types from two different crates #37798

@Digipom

Description

@Digipom

For example:

  • Crate A uses the rand crate from crates.io.
  • Crate B depends on Crate A in Cargo.toml.
  • Crate B wants to instantiate a type from Crate A with a specific random number generator, but forgets to add the rand crate to its own Cargo.toml.

This will lead to the following error:

^ trait rand::XorShiftRng: rand::Rng not satisfied

When really the problem is that the wrong trait is being used because the rand crates are different. An improved error message here mentioning that the trait was found but there is a mis-match would help out a lot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions