@@ -662,9 +662,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
662
662
663
663
fn get_suggestions (
664
664
& self ,
665
- ty : Ty < ' tcx > , // args.type_at(0) / ty
665
+ self_ty : Ty < ' tcx > ,
666
666
def_id : DefId ,
667
- target_type : bool , // false / true
667
+ target_type : bool ,
668
668
param_env : ty:: ParamEnv < ' tcx > ,
669
669
args : Option < & ty:: GenericArgs < ' tcx > > ,
670
670
) -> Vec < String > {
@@ -685,13 +685,13 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
685
685
let args = args. unwrap_or_else ( || empty_args ( def_id) ) ;
686
686
tcx. for_each_relevant_impl (
687
687
tcx. parent ( def_id) , // Trait `DefId`
688
- ty , // `Self` type
688
+ self_ty ,
689
689
|impl_def_id| {
690
690
let impl_args = empty_args ( impl_def_id) ;
691
691
let impl_trait_ref =
692
692
tcx. impl_trait_ref ( impl_def_id) . unwrap ( ) . instantiate ( tcx, impl_args) ;
693
693
let impl_self_ty = impl_trait_ref. self_ty ( ) ;
694
- if self . infcx . can_eq ( param_env, impl_self_ty, ty ) {
694
+ if self . infcx . can_eq ( param_env, impl_self_ty, self_ty ) {
695
695
// The expr's self type could conform to this impl's self type.
696
696
} else {
697
697
// Nope, don't bother.
@@ -714,12 +714,12 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
714
714
return ;
715
715
} ;
716
716
let target = header. trait_ref . skip_binder ( ) . args . type_at ( 0 ) ;
717
- let _ty = header. trait_ref . skip_binder ( ) . args . type_at ( 1 ) ;
718
- if _ty == ty {
717
+ let ty = header. trait_ref . skip_binder ( ) . args . type_at ( 1 ) ;
718
+ if ty == self_ty {
719
719
if target_type {
720
720
paths. push ( format ! ( "{target}" ) ) ;
721
721
} else {
722
- paths. push ( format ! ( "<{ty } as Into<{target}>>::into" ) ) ;
722
+ paths. push ( format ! ( "<{self_ty } as Into<{target}>>::into" ) ) ;
723
723
}
724
724
found = true ;
725
725
}
0 commit comments