@@ -784,14 +784,15 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
784784 }
785785 } ;
786786
787+ let attrs: Vec < _ > = self . get_item_attrs ( id, sess) . collect ( ) ;
787788 SyntaxExtension :: new (
788789 sess,
789790 kind,
790791 self . get_span ( id, sess) ,
791792 helper_attrs,
792793 self . root . edition ,
793794 Symbol :: intern ( name) ,
794- & self . get_item_attrs ( id , sess ) ,
795+ & attrs ,
795796 )
796797 }
797798
@@ -1157,7 +1158,8 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
11571158 // within the crate. We only need this for fictive constructors,
11581159 // for other constructors correct visibilities
11591160 // 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 ( ) ;
11611163 if sess. contains_name ( & attrs, sym:: non_exhaustive) {
11621164 let crate_def_id = self . local_def_id ( CRATE_DEF_INDEX ) ;
11631165 vis = ty:: Visibility :: Restricted ( crate_def_id) ;
@@ -1283,8 +1285,8 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
12831285 }
12841286 }
12851287
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 )
12881290 }
12891291
12901292 fn get_ctor_kind ( & self , node_id : DefIndex ) -> CtorKind {
@@ -1308,7 +1310,11 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
13081310 }
13091311 }
13101312
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 {
13121318 // The attributes for a tuple struct/variant are attached to the definition, not the ctor;
13131319 // we assume that someone passing in a tuple struct ctor is actually wanting to
13141320 // look at the definition
@@ -1325,7 +1331,6 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
13251331 . get ( self , item_id)
13261332 . unwrap_or_else ( Lazy :: empty)
13271333 . decode ( ( self , sess) )
1328- . collect :: < Vec < _ > > ( )
13291334 }
13301335
13311336 fn get_struct_field_names ( & self , id : DefIndex , sess : & Session ) -> Vec < Spanned < Symbol > > {
0 commit comments