Hi, I am working on a compiler plugin and need to find the trait declarations for all traits implemented on a type that are in scope. More specifically, for some method declaration taking a parameter of type
Type that implements
Trait2, I would like to get a reference (
DefId) to the declaration of
Trait1 considering it is the only one of the two in scope (at the definition point of the method).
I looked through
TyCtxt and found ways to get traits in scope, trait declarations from some implementation, but no way to get implementations/declarations for some type. The only reliable way I stumbled upon is via defined methods on the type using
impl_of_method. The issue is that I need to work mostly with marker traits which don't declare any methods.
Does anyone here know what methods/documentation I should look at to achieve this? Cheers!