Misleading message: "error: the trait Foo
is not implemented for the type Bar
" · Issue #32611 · rust-lang/rust (original) (raw)
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."