@@ -496,13 +496,13 @@ pub fn raw_struct_lint<'a, S>(sess: &'a Session,
496496 err
497497}
498498
499- pub trait LintContext : Sized {
499+ pub trait LintContext < ' tcx > : Sized {
500500 fn sess ( & self ) -> & Session ;
501501 fn lints ( & self ) -> & LintStore ;
502502 fn mut_lints ( & mut self ) -> & mut LintStore ;
503503 fn level_stack ( & mut self ) -> & mut Vec < ( LintId , LevelSource ) > ;
504- fn enter_attrs ( & mut self , attrs : & [ ast:: Attribute ] ) ;
505- fn exit_attrs ( & mut self , attrs : & [ ast:: Attribute ] ) ;
504+ fn enter_attrs ( & mut self , attrs : & ' tcx [ ast:: Attribute ] ) ;
505+ fn exit_attrs ( & mut self , attrs : & ' tcx [ ast:: Attribute ] ) ;
506506
507507 /// Get the level of `lint` at the current position of the lint
508508 /// traversal.
@@ -606,7 +606,7 @@ pub trait LintContext: Sized {
606606 /// current lint context, call the provided function, then reset the
607607 /// lints in effect to their previous state.
608608 fn with_lint_attrs < F > ( & mut self ,
609- attrs : & [ ast:: Attribute ] ,
609+ attrs : & ' tcx [ ast:: Attribute ] ,
610610 f : F )
611611 where F : FnOnce ( & mut Self ) ,
612612 {
@@ -729,7 +729,7 @@ impl<'a, 'tcx> LateContext<'a, 'tcx> {
729729 }
730730}
731731
732- impl < ' a , ' tcx > LintContext for LateContext < ' a , ' tcx > {
732+ impl < ' a , ' tcx > LintContext < ' tcx > for LateContext < ' a , ' tcx > {
733733 /// Get the overall compiler `Session` object.
734734 fn sess ( & self ) -> & Session {
735735 & self . tcx . sess
@@ -747,18 +747,18 @@ impl<'a, 'tcx> LintContext for LateContext<'a, 'tcx> {
747747 & mut self . level_stack
748748 }
749749
750- fn enter_attrs ( & mut self , attrs : & [ ast:: Attribute ] ) {
750+ fn enter_attrs ( & mut self , attrs : & ' tcx [ ast:: Attribute ] ) {
751751 debug ! ( "late context: enter_attrs({:?})" , attrs) ;
752752 run_lints ! ( self , enter_lint_attrs, late_passes, attrs) ;
753753 }
754754
755- fn exit_attrs ( & mut self , attrs : & [ ast:: Attribute ] ) {
755+ fn exit_attrs ( & mut self , attrs : & ' tcx [ ast:: Attribute ] ) {
756756 debug ! ( "late context: exit_attrs({:?})" , attrs) ;
757757 run_lints ! ( self , exit_lint_attrs, late_passes, attrs) ;
758758 }
759759}
760760
761- impl < ' a > LintContext for EarlyContext < ' a > {
761+ impl < ' a > LintContext < ' a > for EarlyContext < ' a > {
762762 /// Get the overall compiler `Session` object.
763763 fn sess ( & self ) -> & Session {
764764 & self . sess
@@ -776,12 +776,12 @@ impl<'a> LintContext for EarlyContext<'a> {
776776 & mut self . level_stack
777777 }
778778
779- fn enter_attrs ( & mut self , attrs : & [ ast:: Attribute ] ) {
779+ fn enter_attrs ( & mut self , attrs : & ' a [ ast:: Attribute ] ) {
780780 debug ! ( "early context: enter_attrs({:?})" , attrs) ;
781781 run_lints ! ( self , enter_lint_attrs, early_passes, attrs) ;
782782 }
783783
784- fn exit_attrs ( & mut self , attrs : & [ ast:: Attribute ] ) {
784+ fn exit_attrs ( & mut self , attrs : & ' a [ ast:: Attribute ] ) {
785785 debug ! ( "early context: exit_attrs({:?})" , attrs) ;
786786 run_lints ! ( self , exit_lint_attrs, early_passes, attrs) ;
787787 }
@@ -949,80 +949,80 @@ impl<'a, 'tcx> hir_visit::Visitor<'tcx> for LateContext<'a, 'tcx> {
949949 hir_visit:: walk_path ( self , p) ;
950950 }
951951
952- fn visit_attribute ( & mut self , attr : & ast:: Attribute ) {
952+ fn visit_attribute ( & mut self , attr : & ' tcx ast:: Attribute ) {
953953 check_lint_name_attribute ( self , attr) ;
954954 run_lints ! ( self , check_attribute, late_passes, attr) ;
955955 }
956956}
957957
958- impl < ' a > ast_visit:: Visitor for EarlyContext < ' a > {
959- fn visit_item ( & mut self , it : & ast:: Item ) {
958+ impl < ' a > ast_visit:: Visitor < ' a > for EarlyContext < ' a > {
959+ fn visit_item ( & mut self , it : & ' a ast:: Item ) {
960960 self . with_lint_attrs ( & it. attrs , |cx| {
961961 run_lints ! ( cx, check_item, early_passes, it) ;
962962 ast_visit:: walk_item ( cx, it) ;
963963 run_lints ! ( cx, check_item_post, early_passes, it) ;
964964 } )
965965 }
966966
967- fn visit_foreign_item ( & mut self , it : & ast:: ForeignItem ) {
967+ fn visit_foreign_item ( & mut self , it : & ' a ast:: ForeignItem ) {
968968 self . with_lint_attrs ( & it. attrs , |cx| {
969969 run_lints ! ( cx, check_foreign_item, early_passes, it) ;
970970 ast_visit:: walk_foreign_item ( cx, it) ;
971971 run_lints ! ( cx, check_foreign_item_post, early_passes, it) ;
972972 } )
973973 }
974974
975- fn visit_pat ( & mut self , p : & ast:: Pat ) {
975+ fn visit_pat ( & mut self , p : & ' a ast:: Pat ) {
976976 run_lints ! ( self , check_pat, early_passes, p) ;
977977 ast_visit:: walk_pat ( self , p) ;
978978 }
979979
980- fn visit_expr ( & mut self , e : & ast:: Expr ) {
980+ fn visit_expr ( & mut self , e : & ' a ast:: Expr ) {
981981 self . with_lint_attrs ( & e. attrs , |cx| {
982982 run_lints ! ( cx, check_expr, early_passes, e) ;
983983 ast_visit:: walk_expr ( cx, e) ;
984984 } )
985985 }
986986
987- fn visit_stmt ( & mut self , s : & ast:: Stmt ) {
987+ fn visit_stmt ( & mut self , s : & ' a ast:: Stmt ) {
988988 run_lints ! ( self , check_stmt, early_passes, s) ;
989989 ast_visit:: walk_stmt ( self , s) ;
990990 }
991991
992- fn visit_fn ( & mut self , fk : ast_visit:: FnKind , decl : & ast:: FnDecl ,
992+ fn visit_fn ( & mut self , fk : ast_visit:: FnKind < ' a > , decl : & ' a ast:: FnDecl ,
993993 span : Span , id : ast:: NodeId ) {
994994 run_lints ! ( self , check_fn, early_passes, fk, decl, span, id) ;
995995 ast_visit:: walk_fn ( self , fk, decl, span) ;
996996 run_lints ! ( self , check_fn_post, early_passes, fk, decl, span, id) ;
997997 }
998998
999999 fn visit_variant_data ( & mut self ,
1000- s : & ast:: VariantData ,
1000+ s : & ' a ast:: VariantData ,
10011001 ident : ast:: Ident ,
1002- g : & ast:: Generics ,
1002+ g : & ' a ast:: Generics ,
10031003 item_id : ast:: NodeId ,
10041004 _: Span ) {
10051005 run_lints ! ( self , check_struct_def, early_passes, s, ident, g, item_id) ;
10061006 ast_visit:: walk_struct_def ( self , s) ;
10071007 run_lints ! ( self , check_struct_def_post, early_passes, s, ident, g, item_id) ;
10081008 }
10091009
1010- fn visit_struct_field ( & mut self , s : & ast:: StructField ) {
1010+ fn visit_struct_field ( & mut self , s : & ' a ast:: StructField ) {
10111011 self . with_lint_attrs ( & s. attrs , |cx| {
10121012 run_lints ! ( cx, check_struct_field, early_passes, s) ;
10131013 ast_visit:: walk_struct_field ( cx, s) ;
10141014 } )
10151015 }
10161016
1017- fn visit_variant ( & mut self , v : & ast:: Variant , g : & ast:: Generics , item_id : ast:: NodeId ) {
1017+ fn visit_variant ( & mut self , v : & ' a ast:: Variant , g : & ' a ast:: Generics , item_id : ast:: NodeId ) {
10181018 self . with_lint_attrs ( & v. node . attrs , |cx| {
10191019 run_lints ! ( cx, check_variant, early_passes, v, g) ;
10201020 ast_visit:: walk_variant ( cx, v, g, item_id) ;
10211021 run_lints ! ( cx, check_variant_post, early_passes, v, g) ;
10221022 } )
10231023 }
10241024
1025- fn visit_ty ( & mut self , t : & ast:: Ty ) {
1025+ fn visit_ty ( & mut self , t : & ' a ast:: Ty ) {
10261026 run_lints ! ( self , check_ty, early_passes, t) ;
10271027 ast_visit:: walk_ty ( self , t) ;
10281028 }
@@ -1031,74 +1031,74 @@ impl<'a> ast_visit::Visitor for EarlyContext<'a> {
10311031 run_lints ! ( self , check_ident, early_passes, sp, id) ;
10321032 }
10331033
1034- fn visit_mod ( & mut self , m : & ast:: Mod , s : Span , n : ast:: NodeId ) {
1034+ fn visit_mod ( & mut self , m : & ' a ast:: Mod , s : Span , n : ast:: NodeId ) {
10351035 run_lints ! ( self , check_mod, early_passes, m, s, n) ;
10361036 ast_visit:: walk_mod ( self , m) ;
10371037 run_lints ! ( self , check_mod_post, early_passes, m, s, n) ;
10381038 }
10391039
1040- fn visit_local ( & mut self , l : & ast:: Local ) {
1040+ fn visit_local ( & mut self , l : & ' a ast:: Local ) {
10411041 self . with_lint_attrs ( & l. attrs , |cx| {
10421042 run_lints ! ( cx, check_local, early_passes, l) ;
10431043 ast_visit:: walk_local ( cx, l) ;
10441044 } )
10451045 }
10461046
1047- fn visit_block ( & mut self , b : & ast:: Block ) {
1047+ fn visit_block ( & mut self , b : & ' a ast:: Block ) {
10481048 run_lints ! ( self , check_block, early_passes, b) ;
10491049 ast_visit:: walk_block ( self , b) ;
10501050 run_lints ! ( self , check_block_post, early_passes, b) ;
10511051 }
10521052
1053- fn visit_arm ( & mut self , a : & ast:: Arm ) {
1053+ fn visit_arm ( & mut self , a : & ' a ast:: Arm ) {
10541054 run_lints ! ( self , check_arm, early_passes, a) ;
10551055 ast_visit:: walk_arm ( self , a) ;
10561056 }
10571057
1058- fn visit_expr_post ( & mut self , e : & ast:: Expr ) {
1058+ fn visit_expr_post ( & mut self , e : & ' a ast:: Expr ) {
10591059 run_lints ! ( self , check_expr_post, early_passes, e) ;
10601060 }
10611061
1062- fn visit_generics ( & mut self , g : & ast:: Generics ) {
1062+ fn visit_generics ( & mut self , g : & ' a ast:: Generics ) {
10631063 run_lints ! ( self , check_generics, early_passes, g) ;
10641064 ast_visit:: walk_generics ( self , g) ;
10651065 }
10661066
1067- fn visit_trait_item ( & mut self , trait_item : & ast:: TraitItem ) {
1067+ fn visit_trait_item ( & mut self , trait_item : & ' a ast:: TraitItem ) {
10681068 self . with_lint_attrs ( & trait_item. attrs , |cx| {
10691069 run_lints ! ( cx, check_trait_item, early_passes, trait_item) ;
10701070 ast_visit:: walk_trait_item ( cx, trait_item) ;
10711071 run_lints ! ( cx, check_trait_item_post, early_passes, trait_item) ;
10721072 } ) ;
10731073 }
10741074
1075- fn visit_impl_item ( & mut self , impl_item : & ast:: ImplItem ) {
1075+ fn visit_impl_item ( & mut self , impl_item : & ' a ast:: ImplItem ) {
10761076 self . with_lint_attrs ( & impl_item. attrs , |cx| {
10771077 run_lints ! ( cx, check_impl_item, early_passes, impl_item) ;
10781078 ast_visit:: walk_impl_item ( cx, impl_item) ;
10791079 run_lints ! ( cx, check_impl_item_post, early_passes, impl_item) ;
10801080 } ) ;
10811081 }
10821082
1083- fn visit_lifetime ( & mut self , lt : & ast:: Lifetime ) {
1083+ fn visit_lifetime ( & mut self , lt : & ' a ast:: Lifetime ) {
10841084 run_lints ! ( self , check_lifetime, early_passes, lt) ;
10851085 }
10861086
1087- fn visit_lifetime_def ( & mut self , lt : & ast:: LifetimeDef ) {
1087+ fn visit_lifetime_def ( & mut self , lt : & ' a ast:: LifetimeDef ) {
10881088 run_lints ! ( self , check_lifetime_def, early_passes, lt) ;
10891089 }
10901090
1091- fn visit_path ( & mut self , p : & ast:: Path , id : ast:: NodeId ) {
1091+ fn visit_path ( & mut self , p : & ' a ast:: Path , id : ast:: NodeId ) {
10921092 run_lints ! ( self , check_path, early_passes, p, id) ;
10931093 ast_visit:: walk_path ( self , p) ;
10941094 }
10951095
1096- fn visit_path_list_item ( & mut self , prefix : & ast:: Path , item : & ast:: PathListItem ) {
1096+ fn visit_path_list_item ( & mut self , prefix : & ' a ast:: Path , item : & ' a ast:: PathListItem ) {
10971097 run_lints ! ( self , check_path_list_item, early_passes, item) ;
10981098 ast_visit:: walk_path_list_item ( self , prefix, item) ;
10991099 }
11001100
1101- fn visit_attribute ( & mut self , attr : & ast:: Attribute ) {
1101+ fn visit_attribute ( & mut self , attr : & ' a ast:: Attribute ) {
11021102 run_lints ! ( self , check_attribute, early_passes, attr) ;
11031103 }
11041104}
0 commit comments