Better error when trait not implemented because of different crate version

Someone asked me for help debugging a compilation error and although it didn't take me too long to figure out what was going on, I figure there is some room for improvement with the error message (though the work required to improve it might out weigh the benefit in this case).

Specifically it would be helpful it the compiler would warn us when there is a crate version mismatch and resolving the mismatch would fix the error. Here is what the current error looks like:

error[E0277]: the trait bound `Proxy<'_, &dbus::blocking::Connection>: TraitName` is not satisfied
2582 |         let mut response = TraitName::method_name(&proxy, request.write_to_bytes()?)?;
     |                            ----------------------------------- ^^^^^^ the trait `TraitName` is not implemented for `Proxy<'_, &dbus::blocking::Connection>`
     |                            |
     |                            required by a bound introduced by this call
     = help: the trait `TraitName` is implemented for `dbus::blocking::Proxy<'a, C>`

The trait implementation we had was associated with dbus = "0.9" while the code generating the error was using dbus = "0.8". Some crates use the semver trick to span versions, but if the don't and a developer runs into the above error it isn't immediately obvious why the trait isn't implemented since there is an implementation available (on the wrong crate version).

Any idea on whether this is worth writing up an RFC?


I don't think diagnostic issues use an RFC. Just open an issue / file a PR to fix it. These open issues [1][2][3] seem relevant.

Thanks. Those indeed look relevant especially [2]