@@ -118,6 +118,7 @@ use syntax::util::lev_distance::find_best_match_for_name;
118118use syntax_pos:: { self , BytePos , Span , DUMMY_SP } ;
119119
120120use rustc:: hir:: intravisit:: { self , Visitor , NestedVisitorMap } ;
121+ use rustc:: hir:: itemlikevisit:: ItemLikeVisitor ;
121122use rustc:: hir:: { self , PatKind } ;
122123use rustc:: middle:: lang_items;
123124use rustc_back:: slice;
@@ -515,37 +516,12 @@ impl<'a, 'gcx, 'tcx> Inherited<'a, 'gcx, 'tcx> {
515516
516517struct CheckItemTypesVisitor < ' a , ' tcx : ' a > { tcx : TyCtxt < ' a , ' tcx , ' tcx > }
517518
518- impl < ' a , ' tcx > Visitor < ' tcx > for CheckItemTypesVisitor < ' a , ' tcx > {
519- fn nested_visit_map < ' this > ( & ' this mut self ) -> NestedVisitorMap < ' this , ' tcx > {
520- NestedVisitorMap :: OnlyBodies ( & self . tcx . hir )
521- }
522-
519+ impl < ' a , ' tcx > ItemLikeVisitor < ' tcx > for CheckItemTypesVisitor < ' a , ' tcx > {
523520 fn visit_item ( & mut self , i : & ' tcx hir:: Item ) {
524521 check_item_type ( self . tcx , i) ;
525- intravisit:: walk_item ( self , i) ;
526- }
527-
528- fn visit_ty ( & mut self , t : & ' tcx hir:: Ty ) {
529- match t. node {
530- hir:: TyArray ( _, length) => {
531- self . tcx . item_tables ( self . tcx . hir . local_def_id ( length. node_id ) ) ;
532- }
533- _ => { }
534- }
535-
536- intravisit:: walk_ty ( self , t) ;
537- }
538-
539- fn visit_expr ( & mut self , e : & ' tcx hir:: Expr ) {
540- match e. node {
541- hir:: ExprRepeat ( _, count) => {
542- self . tcx . item_tables ( self . tcx . hir . local_def_id ( count. node_id ) ) ;
543- }
544- _ => { }
545- }
546-
547- intravisit:: walk_expr ( self , e) ;
548522 }
523+ fn visit_trait_item ( & mut self , _: & ' tcx hir:: TraitItem ) { }
524+ fn visit_impl_item ( & mut self , _: & ' tcx hir:: ImplItem ) { }
549525}
550526
551527pub fn check_wf_new < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ) -> CompileResult {
@@ -557,9 +533,8 @@ pub fn check_wf_new<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> CompileResult {
557533
558534pub fn check_item_types < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ) -> CompileResult {
559535 tcx. sess . track_errors ( || {
560- let mut visit = CheckItemTypesVisitor { tcx : tcx } ;
561536 tcx. visit_all_item_likes_in_krate ( DepNode :: TypeckItemType ,
562- & mut visit . as_deep_visitor ( ) ) ;
537+ & mut CheckItemTypesVisitor { tcx } ) ;
563538 } )
564539}
565540
0 commit comments