@@ -496,13 +496,13 @@ pub fn raw_struct_lint<'a, S>(sess: &'a Session,
496
496
err
497
497
}
498
498
499
- pub trait LintContext : Sized {
499
+ pub trait LintContext < ' tcx > : Sized {
500
500
fn sess ( & self ) -> & Session ;
501
501
fn lints ( & self ) -> & LintStore ;
502
502
fn mut_lints ( & mut self ) -> & mut LintStore ;
503
503
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 ] ) ;
506
506
507
507
/// Get the level of `lint` at the current position of the lint
508
508
/// traversal.
@@ -606,7 +606,7 @@ pub trait LintContext: Sized {
606
606
/// current lint context, call the provided function, then reset the
607
607
/// lints in effect to their previous state.
608
608
fn with_lint_attrs < F > ( & mut self ,
609
- attrs : & [ ast:: Attribute ] ,
609
+ attrs : & ' tcx [ ast:: Attribute ] ,
610
610
f : F )
611
611
where F : FnOnce ( & mut Self ) ,
612
612
{
@@ -729,7 +729,7 @@ impl<'a, 'tcx> LateContext<'a, 'tcx> {
729
729
}
730
730
}
731
731
732
- impl < ' a , ' tcx > LintContext for LateContext < ' a , ' tcx > {
732
+ impl < ' a , ' tcx > LintContext < ' tcx > for LateContext < ' a , ' tcx > {
733
733
/// Get the overall compiler `Session` object.
734
734
fn sess ( & self ) -> & Session {
735
735
& self . tcx . sess
@@ -747,18 +747,18 @@ impl<'a, 'tcx> LintContext for LateContext<'a, 'tcx> {
747
747
& mut self . level_stack
748
748
}
749
749
750
- fn enter_attrs ( & mut self , attrs : & [ ast:: Attribute ] ) {
750
+ fn enter_attrs ( & mut self , attrs : & ' tcx [ ast:: Attribute ] ) {
751
751
debug ! ( "late context: enter_attrs({:?})" , attrs) ;
752
752
run_lints ! ( self , enter_lint_attrs, late_passes, attrs) ;
753
753
}
754
754
755
- fn exit_attrs ( & mut self , attrs : & [ ast:: Attribute ] ) {
755
+ fn exit_attrs ( & mut self , attrs : & ' tcx [ ast:: Attribute ] ) {
756
756
debug ! ( "late context: exit_attrs({:?})" , attrs) ;
757
757
run_lints ! ( self , exit_lint_attrs, late_passes, attrs) ;
758
758
}
759
759
}
760
760
761
- impl < ' a > LintContext for EarlyContext < ' a > {
761
+ impl < ' a > LintContext < ' a > for EarlyContext < ' a > {
762
762
/// Get the overall compiler `Session` object.
763
763
fn sess ( & self ) -> & Session {
764
764
& self . sess
@@ -776,12 +776,12 @@ impl<'a> LintContext for EarlyContext<'a> {
776
776
& mut self . level_stack
777
777
}
778
778
779
- fn enter_attrs ( & mut self , attrs : & [ ast:: Attribute ] ) {
779
+ fn enter_attrs ( & mut self , attrs : & ' a [ ast:: Attribute ] ) {
780
780
debug ! ( "early context: enter_attrs({:?})" , attrs) ;
781
781
run_lints ! ( self , enter_lint_attrs, early_passes, attrs) ;
782
782
}
783
783
784
- fn exit_attrs ( & mut self , attrs : & [ ast:: Attribute ] ) {
784
+ fn exit_attrs ( & mut self , attrs : & ' a [ ast:: Attribute ] ) {
785
785
debug ! ( "early context: exit_attrs({:?})" , attrs) ;
786
786
run_lints ! ( self , exit_lint_attrs, early_passes, attrs) ;
787
787
}
@@ -949,80 +949,80 @@ impl<'a, 'tcx> hir_visit::Visitor<'tcx> for LateContext<'a, 'tcx> {
949
949
hir_visit:: walk_path ( self , p) ;
950
950
}
951
951
952
- fn visit_attribute ( & mut self , attr : & ast:: Attribute ) {
952
+ fn visit_attribute ( & mut self , attr : & ' tcx ast:: Attribute ) {
953
953
check_lint_name_attribute ( self , attr) ;
954
954
run_lints ! ( self , check_attribute, late_passes, attr) ;
955
955
}
956
956
}
957
957
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 ) {
960
960
self . with_lint_attrs ( & it. attrs , |cx| {
961
961
run_lints ! ( cx, check_item, early_passes, it) ;
962
962
ast_visit:: walk_item ( cx, it) ;
963
963
run_lints ! ( cx, check_item_post, early_passes, it) ;
964
964
} )
965
965
}
966
966
967
- fn visit_foreign_item ( & mut self , it : & ast:: ForeignItem ) {
967
+ fn visit_foreign_item ( & mut self , it : & ' a ast:: ForeignItem ) {
968
968
self . with_lint_attrs ( & it. attrs , |cx| {
969
969
run_lints ! ( cx, check_foreign_item, early_passes, it) ;
970
970
ast_visit:: walk_foreign_item ( cx, it) ;
971
971
run_lints ! ( cx, check_foreign_item_post, early_passes, it) ;
972
972
} )
973
973
}
974
974
975
- fn visit_pat ( & mut self , p : & ast:: Pat ) {
975
+ fn visit_pat ( & mut self , p : & ' a ast:: Pat ) {
976
976
run_lints ! ( self , check_pat, early_passes, p) ;
977
977
ast_visit:: walk_pat ( self , p) ;
978
978
}
979
979
980
- fn visit_expr ( & mut self , e : & ast:: Expr ) {
980
+ fn visit_expr ( & mut self , e : & ' a ast:: Expr ) {
981
981
self . with_lint_attrs ( & e. attrs , |cx| {
982
982
run_lints ! ( cx, check_expr, early_passes, e) ;
983
983
ast_visit:: walk_expr ( cx, e) ;
984
984
} )
985
985
}
986
986
987
- fn visit_stmt ( & mut self , s : & ast:: Stmt ) {
987
+ fn visit_stmt ( & mut self , s : & ' a ast:: Stmt ) {
988
988
run_lints ! ( self , check_stmt, early_passes, s) ;
989
989
ast_visit:: walk_stmt ( self , s) ;
990
990
}
991
991
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 ,
993
993
span : Span , id : ast:: NodeId ) {
994
994
run_lints ! ( self , check_fn, early_passes, fk, decl, span, id) ;
995
995
ast_visit:: walk_fn ( self , fk, decl, span) ;
996
996
run_lints ! ( self , check_fn_post, early_passes, fk, decl, span, id) ;
997
997
}
998
998
999
999
fn visit_variant_data ( & mut self ,
1000
- s : & ast:: VariantData ,
1000
+ s : & ' a ast:: VariantData ,
1001
1001
ident : ast:: Ident ,
1002
- g : & ast:: Generics ,
1002
+ g : & ' a ast:: Generics ,
1003
1003
item_id : ast:: NodeId ,
1004
1004
_: Span ) {
1005
1005
run_lints ! ( self , check_struct_def, early_passes, s, ident, g, item_id) ;
1006
1006
ast_visit:: walk_struct_def ( self , s) ;
1007
1007
run_lints ! ( self , check_struct_def_post, early_passes, s, ident, g, item_id) ;
1008
1008
}
1009
1009
1010
- fn visit_struct_field ( & mut self , s : & ast:: StructField ) {
1010
+ fn visit_struct_field ( & mut self , s : & ' a ast:: StructField ) {
1011
1011
self . with_lint_attrs ( & s. attrs , |cx| {
1012
1012
run_lints ! ( cx, check_struct_field, early_passes, s) ;
1013
1013
ast_visit:: walk_struct_field ( cx, s) ;
1014
1014
} )
1015
1015
}
1016
1016
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 ) {
1018
1018
self . with_lint_attrs ( & v. node . attrs , |cx| {
1019
1019
run_lints ! ( cx, check_variant, early_passes, v, g) ;
1020
1020
ast_visit:: walk_variant ( cx, v, g, item_id) ;
1021
1021
run_lints ! ( cx, check_variant_post, early_passes, v, g) ;
1022
1022
} )
1023
1023
}
1024
1024
1025
- fn visit_ty ( & mut self , t : & ast:: Ty ) {
1025
+ fn visit_ty ( & mut self , t : & ' a ast:: Ty ) {
1026
1026
run_lints ! ( self , check_ty, early_passes, t) ;
1027
1027
ast_visit:: walk_ty ( self , t) ;
1028
1028
}
@@ -1031,74 +1031,74 @@ impl<'a> ast_visit::Visitor for EarlyContext<'a> {
1031
1031
run_lints ! ( self , check_ident, early_passes, sp, id) ;
1032
1032
}
1033
1033
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 ) {
1035
1035
run_lints ! ( self , check_mod, early_passes, m, s, n) ;
1036
1036
ast_visit:: walk_mod ( self , m) ;
1037
1037
run_lints ! ( self , check_mod_post, early_passes, m, s, n) ;
1038
1038
}
1039
1039
1040
- fn visit_local ( & mut self , l : & ast:: Local ) {
1040
+ fn visit_local ( & mut self , l : & ' a ast:: Local ) {
1041
1041
self . with_lint_attrs ( & l. attrs , |cx| {
1042
1042
run_lints ! ( cx, check_local, early_passes, l) ;
1043
1043
ast_visit:: walk_local ( cx, l) ;
1044
1044
} )
1045
1045
}
1046
1046
1047
- fn visit_block ( & mut self , b : & ast:: Block ) {
1047
+ fn visit_block ( & mut self , b : & ' a ast:: Block ) {
1048
1048
run_lints ! ( self , check_block, early_passes, b) ;
1049
1049
ast_visit:: walk_block ( self , b) ;
1050
1050
run_lints ! ( self , check_block_post, early_passes, b) ;
1051
1051
}
1052
1052
1053
- fn visit_arm ( & mut self , a : & ast:: Arm ) {
1053
+ fn visit_arm ( & mut self , a : & ' a ast:: Arm ) {
1054
1054
run_lints ! ( self , check_arm, early_passes, a) ;
1055
1055
ast_visit:: walk_arm ( self , a) ;
1056
1056
}
1057
1057
1058
- fn visit_expr_post ( & mut self , e : & ast:: Expr ) {
1058
+ fn visit_expr_post ( & mut self , e : & ' a ast:: Expr ) {
1059
1059
run_lints ! ( self , check_expr_post, early_passes, e) ;
1060
1060
}
1061
1061
1062
- fn visit_generics ( & mut self , g : & ast:: Generics ) {
1062
+ fn visit_generics ( & mut self , g : & ' a ast:: Generics ) {
1063
1063
run_lints ! ( self , check_generics, early_passes, g) ;
1064
1064
ast_visit:: walk_generics ( self , g) ;
1065
1065
}
1066
1066
1067
- fn visit_trait_item ( & mut self , trait_item : & ast:: TraitItem ) {
1067
+ fn visit_trait_item ( & mut self , trait_item : & ' a ast:: TraitItem ) {
1068
1068
self . with_lint_attrs ( & trait_item. attrs , |cx| {
1069
1069
run_lints ! ( cx, check_trait_item, early_passes, trait_item) ;
1070
1070
ast_visit:: walk_trait_item ( cx, trait_item) ;
1071
1071
run_lints ! ( cx, check_trait_item_post, early_passes, trait_item) ;
1072
1072
} ) ;
1073
1073
}
1074
1074
1075
- fn visit_impl_item ( & mut self , impl_item : & ast:: ImplItem ) {
1075
+ fn visit_impl_item ( & mut self , impl_item : & ' a ast:: ImplItem ) {
1076
1076
self . with_lint_attrs ( & impl_item. attrs , |cx| {
1077
1077
run_lints ! ( cx, check_impl_item, early_passes, impl_item) ;
1078
1078
ast_visit:: walk_impl_item ( cx, impl_item) ;
1079
1079
run_lints ! ( cx, check_impl_item_post, early_passes, impl_item) ;
1080
1080
} ) ;
1081
1081
}
1082
1082
1083
- fn visit_lifetime ( & mut self , lt : & ast:: Lifetime ) {
1083
+ fn visit_lifetime ( & mut self , lt : & ' a ast:: Lifetime ) {
1084
1084
run_lints ! ( self , check_lifetime, early_passes, lt) ;
1085
1085
}
1086
1086
1087
- fn visit_lifetime_def ( & mut self , lt : & ast:: LifetimeDef ) {
1087
+ fn visit_lifetime_def ( & mut self , lt : & ' a ast:: LifetimeDef ) {
1088
1088
run_lints ! ( self , check_lifetime_def, early_passes, lt) ;
1089
1089
}
1090
1090
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 ) {
1092
1092
run_lints ! ( self , check_path, early_passes, p, id) ;
1093
1093
ast_visit:: walk_path ( self , p) ;
1094
1094
}
1095
1095
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 ) {
1097
1097
run_lints ! ( self , check_path_list_item, early_passes, item) ;
1098
1098
ast_visit:: walk_path_list_item ( self , prefix, item) ;
1099
1099
}
1100
1100
1101
- fn visit_attribute ( & mut self , attr : & ast:: Attribute ) {
1101
+ fn visit_attribute ( & mut self , attr : & ' a ast:: Attribute ) {
1102
1102
run_lints ! ( self , check_attribute, early_passes, attr) ;
1103
1103
}
1104
1104
}
0 commit comments