Stream: t-compiler

Topic: diagnostics for crate version mismatch


Timo Freiberg (Nov 12 2019 at 19:53, on Zulip):

Hi everyone, I'm trying to work on https://github.com/rust-lang/rust/issues/22750, trying to add a help message to the the trait X is not implemented for MyStruct message if MyStruct implements a trait X from a different crate version.
I actually got that message working here, but I would very much like to show the expected and actual crate versions. I have no idea if that's even possible in rustc, I didn't find anything outside of rustdoc. Any suggestions?

Esteban K├╝ber (Nov 12 2019 at 23:23, on Zulip):

It seems to me that you _could_ use self.tcx.crate_hash(), but the result of that is not something that a user would necessarily be able to relate to anything. Making the error include the crate version would entail 1) adding an optional flag to rustc to accept a crate version string and 2) make cargo pass that flag in when compiling a crate.

Timo Freiberg (Nov 13 2019 at 15:46, on Zulip):

Thanks again for the response! Okay, I think I'll probably first try to add some helpful diagnostics without including the crate version.

Last update: Dec 12 2019 at 00:55UTC