@@ -1191,16 +1191,7 @@ impl<'tcx> Visitor<'tcx> for TypePrivacyVisitor<'tcx> {
11911191 fn visit_generic_arg ( & mut self , generic_arg : & ' tcx hir:: GenericArg < ' tcx > ) {
11921192 match generic_arg {
11931193 hir:: GenericArg :: Type ( t) => self . visit_ty ( t) ,
1194- hir:: GenericArg :: Infer ( inf) => {
1195- self . span = inf. span ;
1196- let parent_hir_id = self . tcx . hir ( ) . get_parent_node ( inf. hir_id ) ;
1197- if let Some ( typeck_results) = self . maybe_typeck_results {
1198- let node_substs = typeck_results. node_substs ( parent_hir_id) ;
1199- for ty in node_substs. types ( ) {
1200- self . visit ( ty) ;
1201- }
1202- }
1203- }
1194+ hir:: GenericArg :: Infer ( inf) => self . visit_infer ( inf) ,
12041195 hir:: GenericArg :: Lifetime ( _) | hir:: GenericArg :: Const ( _) => { }
12051196 }
12061197 }
@@ -1224,6 +1215,23 @@ impl<'tcx> Visitor<'tcx> for TypePrivacyVisitor<'tcx> {
12241215 intravisit:: walk_ty ( self , hir_ty) ;
12251216 }
12261217
1218+ fn visit_infer ( & mut self , inf : & ' tcx hir:: InferArg ) {
1219+ self . span = inf. span ;
1220+ if let Some ( typeck_results) = self . maybe_typeck_results {
1221+ if let Some ( ty) = typeck_results. node_type_opt ( inf. hir_id ) {
1222+ if self . visit ( ty) . is_break ( ) {
1223+ return ;
1224+ }
1225+ }
1226+ } else {
1227+ // FIXME see above note for same issue.
1228+ if self . visit ( rustc_typeck:: hir_ty_to_ty ( self . tcx , & inf. to_ty ( ) ) ) . is_break ( ) {
1229+ return ;
1230+ }
1231+ }
1232+ intravisit:: walk_inf ( self , inf) ;
1233+ }
1234+
12271235 fn visit_trait_ref ( & mut self , trait_ref : & ' tcx hir:: TraitRef < ' tcx > ) {
12281236 self . span = trait_ref. path . span ;
12291237 if self . maybe_typeck_results . is_none ( ) {
0 commit comments