@@ -692,6 +692,11 @@ impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> {
692692 }
693693 }
694694
695+ fn node_substs_opt ( & self , hir_id : HirId ) -> Option < SubstsRef < ' tcx > > {
696+ let substs = self . typeck_results . node_substs_opt ( hir_id) ;
697+ self . infcx . resolve_vars_if_possible ( substs)
698+ }
699+
695700 fn opt_node_type ( & self , hir_id : HirId ) -> Option < Ty < ' tcx > > {
696701 let ty = self . typeck_results . node_type_opt ( hir_id) ;
697702 self . infcx . resolve_vars_if_possible ( ty)
@@ -774,7 +779,7 @@ impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> {
774779 let tcx = self . infcx . tcx ;
775780 match expr. kind {
776781 hir:: ExprKind :: Path ( ref path) => {
777- if let Some ( substs) = self . typeck_results . node_substs_opt ( expr. hir_id ) {
782+ if let Some ( substs) = self . node_substs_opt ( expr. hir_id ) {
778783 return self . path_inferred_subst_iter ( expr. hir_id , substs, path) ;
779784 }
780785 }
@@ -802,7 +807,7 @@ impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> {
802807 if generics. has_impl_trait ( ) {
803808 None ?
804809 }
805- let substs = self . typeck_results . node_substs_opt ( expr. hir_id ) ?;
810+ let substs = self . node_substs_opt ( expr. hir_id ) ?;
806811 let span = tcx. hir ( ) . span ( segment. hir_id ?) ;
807812 let insert_span = segment. ident . span . shrink_to_hi ( ) . with_hi ( span. hi ( ) ) ;
808813 InsertableGenericArgs {
@@ -1074,7 +1079,7 @@ impl<'a, 'tcx> Visitor<'tcx> for FindInferSourceVisitor<'a, 'tcx> {
10741079 . any ( |generics| generics. has_impl_trait ( ) )
10751080 } ;
10761081 if let ExprKind :: MethodCall ( path, args, span) = expr. kind
1077- && let Some ( substs) = self . typeck_results . node_substs_opt ( expr. hir_id )
1082+ && let Some ( substs) = self . node_substs_opt ( expr. hir_id )
10781083 && substs. iter ( ) . any ( |arg| self . generic_arg_contains_target ( arg) )
10791084 && let Some ( def_id) = self . typeck_results . type_dependent_def_id ( expr. hir_id )
10801085 && self . infcx . tcx . trait_of_item ( def_id) . is_some ( )
0 commit comments