@@ -784,14 +784,15 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
784
784
}
785
785
} ;
786
786
787
+ let attrs: Vec < _ > = self . get_item_attrs ( id, sess) . collect ( ) ;
787
788
SyntaxExtension :: new (
788
789
sess,
789
790
kind,
790
791
self . get_span ( id, sess) ,
791
792
helper_attrs,
792
793
self . root . edition ,
793
794
Symbol :: intern ( name) ,
794
- & self . get_item_attrs ( id , sess ) ,
795
+ & attrs ,
795
796
)
796
797
}
797
798
@@ -1157,7 +1158,8 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1157
1158
// within the crate. We only need this for fictive constructors,
1158
1159
// for other constructors correct visibilities
1159
1160
// were already encoded in metadata.
1160
- let attrs = self . get_item_attrs ( def_id. index , sess) ;
1161
+ let attrs: Vec < _ > =
1162
+ self . get_item_attrs ( def_id. index , sess) . collect ( ) ;
1161
1163
if sess. contains_name ( & attrs, sym:: non_exhaustive) {
1162
1164
let crate_def_id = self . local_def_id ( CRATE_DEF_INDEX ) ;
1163
1165
vis = ty:: Visibility :: Restricted ( crate_def_id) ;
@@ -1283,8 +1285,8 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1283
1285
}
1284
1286
}
1285
1287
1286
- fn get_item_variances ( & self , id : DefIndex ) -> Vec < ty:: Variance > {
1287
- self . root . tables . variances . get ( self , id) . unwrap_or_else ( Lazy :: empty) . decode ( self ) . collect ( )
1288
+ fn get_item_variances ( & ' a self , id : DefIndex ) -> impl Iterator < Item = ty:: Variance > + ' a {
1289
+ self . root . tables . variances . get ( self , id) . unwrap_or_else ( Lazy :: empty) . decode ( self )
1288
1290
}
1289
1291
1290
1292
fn get_ctor_kind ( & self , node_id : DefIndex ) -> CtorKind {
@@ -1308,7 +1310,11 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1308
1310
}
1309
1311
}
1310
1312
1311
- fn get_item_attrs ( & self , node_id : DefIndex , sess : & Session ) -> Vec < ast:: Attribute > {
1313
+ fn get_item_attrs (
1314
+ & ' a self ,
1315
+ node_id : DefIndex ,
1316
+ sess : & ' a Session ,
1317
+ ) -> impl Iterator < Item = ast:: Attribute > + ' a {
1312
1318
// The attributes for a tuple struct/variant are attached to the definition, not the ctor;
1313
1319
// we assume that someone passing in a tuple struct ctor is actually wanting to
1314
1320
// look at the definition
@@ -1325,7 +1331,6 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
1325
1331
. get ( self , item_id)
1326
1332
. unwrap_or_else ( Lazy :: empty)
1327
1333
. decode ( ( self , sess) )
1328
- . collect :: < Vec < _ > > ( )
1329
1334
}
1330
1335
1331
1336
fn get_struct_field_names ( & self , id : DefIndex , sess : & Session ) -> Vec < Spanned < Symbol > > {
0 commit comments