rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
94.94k stars 12.24k forks source link

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

Open Yoric opened 8 years ago

Yoric commented 8 years ago

Consider three crates High, Mid and Low, where:

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."
steveklabnik commented 4 years ago

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.