pub fn try_to_devirtualize<'tcx>(
    tcx: TyCtxt<'tcx>,
    def_id: DefId,
    gen_args: GenericArgsRef<'tcx>
) -> Option<(DefId, GenericArgsRef<'tcx>)>
Expand description

Try to devirtualize a trait method with def_id and gen_args.

Returns None if the given def_id does not correspond to a trait method or we cannot resolve the trait method to a specific instance. For example, the first gen_arg is a dynamic type.