Hi everyone, i would like to help with https://github.com/rust-lang/rust/issues/22750 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
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
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?
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.
Thanks for the reply :) I'm going to try working on it a little bit more.