4
4
//! conflicts between multiple such attributes attached to the same
5
5
//! item.
6
6
7
- use crate :: hir:: { self , HirId , HirVec , Attribute , Item , ItemKind , TraitItem , TraitItemKind } ;
7
+ use crate :: hir:: { self , HirId , Attribute , Item , ItemKind , TraitItem , TraitItemKind } ;
8
8
use crate :: hir:: DUMMY_HIR_ID ;
9
9
use crate :: hir:: def_id:: DefId ;
10
10
use crate :: hir:: intravisit:: { self , Visitor , NestedVisitorMap } ;
@@ -86,7 +86,7 @@ impl Display for Target {
86
86
}
87
87
88
88
impl Target {
89
- pub ( crate ) fn from_item ( item : & Item ) -> Target {
89
+ pub ( crate ) fn from_item ( item : & Item < ' _ > ) -> Target {
90
90
match item. kind {
91
91
ItemKind :: ExternCrate ( ..) => Target :: ExternCrate ,
92
92
ItemKind :: Use ( ..) => Target :: Use ,
@@ -107,7 +107,7 @@ impl Target {
107
107
}
108
108
}
109
109
110
- fn from_trait_item ( trait_item : & TraitItem ) -> Target {
110
+ fn from_trait_item ( trait_item : & TraitItem < ' _ > ) -> Target {
111
111
match trait_item. kind {
112
112
TraitItemKind :: Const ( ..) => Target :: AssocConst ,
113
113
TraitItemKind :: Method ( _, hir:: TraitMethod :: Required ( _) ) => {
@@ -120,15 +120,15 @@ impl Target {
120
120
}
121
121
}
122
122
123
- fn from_foreign_item ( foreign_item : & hir:: ForeignItem ) -> Target {
123
+ fn from_foreign_item ( foreign_item : & hir:: ForeignItem < ' _ > ) -> Target {
124
124
match foreign_item. kind {
125
125
hir:: ForeignItemKind :: Fn ( ..) => Target :: ForeignFn ,
126
126
hir:: ForeignItemKind :: Static ( ..) => Target :: ForeignStatic ,
127
127
hir:: ForeignItemKind :: Type => Target :: ForeignTy ,
128
128
}
129
129
}
130
130
131
- fn from_impl_item < ' tcx > ( tcx : TyCtxt < ' tcx > , impl_item : & hir:: ImplItem ) -> Target {
131
+ fn from_impl_item < ' tcx > ( tcx : TyCtxt < ' tcx > , impl_item : & hir:: ImplItem < ' _ > ) -> Target {
132
132
match impl_item. kind {
133
133
hir:: ImplItemKind :: Const ( ..) => Target :: AssocConst ,
134
134
hir:: ImplItemKind :: Method ( ..) => {
@@ -158,10 +158,10 @@ impl CheckAttrVisitor<'tcx> {
158
158
fn check_attributes (
159
159
& self ,
160
160
hir_id : HirId ,
161
- attrs : & HirVec < Attribute > ,
161
+ attrs : & ' hir [ Attribute ] ,
162
162
span : & Span ,
163
163
target : Target ,
164
- item : Option < & Item > ,
164
+ item : Option < & Item < ' _ > > ,
165
165
) {
166
166
let mut is_valid = true ;
167
167
for attr in attrs {
@@ -241,7 +241,7 @@ impl CheckAttrVisitor<'tcx> {
241
241
fn check_track_caller (
242
242
& self ,
243
243
attr_span : & Span ,
244
- attrs : & HirVec < Attribute > ,
244
+ attrs : & ' hir [ Attribute ] ,
245
245
span : & Span ,
246
246
target : Target ,
247
247
) -> bool {
@@ -332,10 +332,10 @@ impl CheckAttrVisitor<'tcx> {
332
332
/// Checks if the `#[repr]` attributes on `item` are valid.
333
333
fn check_repr (
334
334
& self ,
335
- attrs : & HirVec < Attribute > ,
335
+ attrs : & ' hir [ Attribute ] ,
336
336
span : & Span ,
337
337
target : Target ,
338
- item : Option < & Item > ,
338
+ item : Option < & Item < ' _ > > ,
339
339
) {
340
340
// Extract the names of all repr hints, e.g., [foo, bar, align] for:
341
341
// ```
@@ -477,7 +477,7 @@ impl CheckAttrVisitor<'tcx> {
477
477
}
478
478
}
479
479
480
- fn check_used ( & self , attrs : & HirVec < Attribute > , target : Target ) {
480
+ fn check_used ( & self , attrs : & ' hir [ Attribute ] , target : Target ) {
481
481
for attr in attrs {
482
482
if attr. check_name ( sym:: used) && target != Target :: Static {
483
483
self . tcx . sess
@@ -492,25 +492,25 @@ impl Visitor<'tcx> for CheckAttrVisitor<'tcx> {
492
492
NestedVisitorMap :: OnlyBodies ( & self . tcx . hir ( ) )
493
493
}
494
494
495
- fn visit_item ( & mut self , item : & ' tcx Item ) {
495
+ fn visit_item ( & mut self , item : & ' tcx Item < ' tcx > ) {
496
496
let target = Target :: from_item ( item) ;
497
- self . check_attributes ( item. hir_id , & item. attrs , & item. span , target, Some ( item) ) ;
497
+ self . check_attributes ( item. hir_id , item. attrs , & item. span , target, Some ( item) ) ;
498
498
intravisit:: walk_item ( self , item)
499
499
}
500
500
501
- fn visit_trait_item ( & mut self , trait_item : & ' tcx TraitItem ) {
501
+ fn visit_trait_item ( & mut self , trait_item : & ' tcx TraitItem < ' tcx > ) {
502
502
let target = Target :: from_trait_item ( trait_item) ;
503
503
self . check_attributes ( trait_item. hir_id , & trait_item. attrs , & trait_item. span , target, None ) ;
504
504
intravisit:: walk_trait_item ( self , trait_item)
505
505
}
506
506
507
- fn visit_foreign_item ( & mut self , f_item : & ' tcx hir:: ForeignItem ) {
507
+ fn visit_foreign_item ( & mut self , f_item : & ' tcx hir:: ForeignItem < ' tcx > ) {
508
508
let target = Target :: from_foreign_item ( f_item) ;
509
509
self . check_attributes ( f_item. hir_id , & f_item. attrs , & f_item. span , target, None ) ;
510
510
intravisit:: walk_foreign_item ( self , f_item)
511
511
}
512
512
513
- fn visit_impl_item ( & mut self , impl_item : & ' tcx hir:: ImplItem ) {
513
+ fn visit_impl_item ( & mut self , impl_item : & ' tcx hir:: ImplItem < ' tcx > ) {
514
514
let target = Target :: from_impl_item ( self . tcx , impl_item) ;
515
515
self . check_attributes ( impl_item. hir_id , & impl_item. attrs , & impl_item. span , target, None ) ;
516
516
intravisit:: walk_impl_item ( self , impl_item)
@@ -527,9 +527,9 @@ impl Visitor<'tcx> for CheckAttrVisitor<'tcx> {
527
527
}
528
528
}
529
529
530
- fn is_c_like_enum ( item : & Item ) -> bool {
530
+ fn is_c_like_enum ( item : & Item < ' _ > ) -> bool {
531
531
if let ItemKind :: Enum ( ref def, _) = item. kind {
532
- for variant in & def. variants {
532
+ for variant in def. variants {
533
533
match variant. data {
534
534
hir:: VariantData :: Unit ( ..) => { /* continue */ }
535
535
_ => return false ,
0 commit comments