@@ -118,6 +118,7 @@ use syntax::util::lev_distance::find_best_match_for_name;
118
118
use syntax_pos:: { self , BytePos , Span , DUMMY_SP } ;
119
119
120
120
use rustc:: hir:: intravisit:: { self , Visitor , NestedVisitorMap } ;
121
+ use rustc:: hir:: itemlikevisit:: ItemLikeVisitor ;
121
122
use rustc:: hir:: { self , PatKind } ;
122
123
use rustc:: middle:: lang_items;
123
124
use rustc_back:: slice;
@@ -515,37 +516,12 @@ impl<'a, 'gcx, 'tcx> Inherited<'a, 'gcx, 'tcx> {
515
516
516
517
struct CheckItemTypesVisitor < ' a , ' tcx : ' a > { tcx : TyCtxt < ' a , ' tcx , ' tcx > }
517
518
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 > {
523
520
fn visit_item ( & mut self , i : & ' tcx hir:: Item ) {
524
521
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) ;
548
522
}
523
+ fn visit_trait_item ( & mut self , _: & ' tcx hir:: TraitItem ) { }
524
+ fn visit_impl_item ( & mut self , _: & ' tcx hir:: ImplItem ) { }
549
525
}
550
526
551
527
pub 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 {
557
533
558
534
pub fn check_item_types < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ) -> CompileResult {
559
535
tcx. sess . track_errors ( || {
560
- let mut visit = CheckItemTypesVisitor { tcx : tcx } ;
561
536
tcx. visit_all_item_likes_in_krate ( DepNode :: TypeckItemType ,
562
- & mut visit . as_deep_visitor ( ) ) ;
537
+ & mut CheckItemTypesVisitor { tcx } ) ;
563
538
} )
564
539
}
565
540
0 commit comments