pub fn trait_ref_of_method<'tcx>(
    cx: &LateContext<'tcx>,
    def_id: LocalDefId
) -> Option<&'tcx TraitRef<'tcx>>
Expand description

Gets the hir::TraitRef of the trait the given method is implemented for.

Use this if you want to find the TraitRef of the Add trait in this example:

struct Point(isize, isize);

impl std::ops::Add for Point {
    type Output = Self;

    fn add(self, other: Self) -> Self {
        Point(0, 0)
    }
}