Stream: t-compiler/wg-diagnostics

Topic: crate version mismatch error messages

Timo Freiberg (Nov 02 2019 at 16:00, on Zulip):

Hi everyone, i would like to help with but i'm stuck with the implementation, maybe someone could help me out?

i found the method that reports the trait Foo is not implemented for Bar error here and I thought I'd add a function call there that looks at the traits that traif_ref.self_ty() actually implements and generate a helpful message if any of those traits has the same name(/path) as trait_ref

Assuming that's a reasonable approach, I don't know how to get the implemented traits of trait_ref.self_ty(). All further queries in TyCtxt (or the HIR-Map) seem to require a DefId or HirId, and I haven't found a way to get the DefId of a Ty. Also, I'm not sure how to get the implemented traits of a type, should I call TyCtxt::for_each_relevant_impl and do the work in a closure?

Esteban K├╝ber (Nov 08 2019 at 22:44, on Zulip):

Seems very wasteful.
Timo Freiberg as long as the wastefulness only happens outside of the happy path (only when emitting errors), that is usually ok.

Timo Freiberg (Nov 11 2019 at 20:34, on Zulip):

Thanks for the reply :) I'm going to try working on it a little bit more.

Last update: Mar 31 2020 at 02:55UTC