@@ -692,6 +692,11 @@ impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> {
692
692
}
693
693
}
694
694
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
+
695
700
fn opt_node_type ( & self , hir_id : HirId ) -> Option < Ty < ' tcx > > {
696
701
let ty = self . typeck_results . node_type_opt ( hir_id) ;
697
702
self . infcx . resolve_vars_if_possible ( ty)
@@ -774,7 +779,7 @@ impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> {
774
779
let tcx = self . infcx . tcx ;
775
780
match expr. kind {
776
781
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 ) {
778
783
return self . path_inferred_subst_iter ( expr. hir_id , substs, path) ;
779
784
}
780
785
}
@@ -802,7 +807,7 @@ impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> {
802
807
if generics. has_impl_trait ( ) {
803
808
None ?
804
809
}
805
- let substs = self . typeck_results . node_substs_opt ( expr. hir_id ) ?;
810
+ let substs = self . node_substs_opt ( expr. hir_id ) ?;
806
811
let span = tcx. hir ( ) . span ( segment. hir_id ?) ;
807
812
let insert_span = segment. ident . span . shrink_to_hi ( ) . with_hi ( span. hi ( ) ) ;
808
813
InsertableGenericArgs {
@@ -1074,7 +1079,7 @@ impl<'a, 'tcx> Visitor<'tcx> for FindInferSourceVisitor<'a, 'tcx> {
1074
1079
. any ( |generics| generics. has_impl_trait ( ) )
1075
1080
} ;
1076
1081
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 )
1078
1083
&& substs. iter ( ) . any ( |arg| self . generic_arg_contains_target ( arg) )
1079
1084
&& let Some ( def_id) = self . typeck_results . type_dependent_def_id ( expr. hir_id )
1080
1085
&& self . infcx . tcx . trait_of_item ( def_id) . is_some ( )
0 commit comments