File tree 2 files changed +16
-26
lines changed
rustc_metadata/src/rmeta/decoder
2 files changed +16
-26
lines changed Original file line number Diff line number Diff line change @@ -415,16 +415,12 @@ impl CStore {
415
415
416
416
let span = data. get_span ( id. index , sess) ;
417
417
418
- let attrs = data. get_item_attrs ( id. index , sess) . collect ( ) ;
419
-
420
- let ident = data. item_ident ( id. index , sess) ;
421
-
422
418
LoadedMacro :: MacroDef (
423
419
ast:: Item {
424
- ident,
420
+ ident : data . item_ident ( id . index , sess ) ,
425
421
id : ast:: DUMMY_NODE_ID ,
426
422
span,
427
- attrs,
423
+ attrs : data . get_item_attrs ( id . index , sess ) . collect ( ) ,
428
424
kind : ast:: ItemKind :: MacroDef ( data. get_macro ( id. index , sess) ) ,
429
425
vis : ast:: Visibility {
430
426
span : span. shrink_to_lo ( ) ,
Original file line number Diff line number Diff line change @@ -3419,27 +3419,21 @@ impl<'a> Resolver<'a> {
3419
3419
return v. clone ( ) ;
3420
3420
}
3421
3421
3422
- let parse_attrs = || {
3423
- let attrs = self . cstore ( ) . item_attrs ( def_id, self . session ) ;
3424
- let attr =
3425
- attrs. iter ( ) . find ( |a| a. has_name ( sym:: rustc_legacy_const_generics) ) ?;
3426
- let mut ret = vec ! [ ] ;
3427
- for meta in attr. meta_item_list ( ) ? {
3428
- match meta. literal ( ) ?. kind {
3429
- LitKind :: Int ( a, _) => {
3430
- ret. push ( a as usize ) ;
3431
- }
3432
- _ => panic ! ( "invalid arg index" ) ,
3433
- }
3422
+ let attr = self
3423
+ . cstore ( )
3424
+ . item_attrs ( def_id, self . session )
3425
+ . into_iter ( )
3426
+ . find ( |a| a. has_name ( sym:: rustc_legacy_const_generics) ) ?;
3427
+ let mut ret = Vec :: new ( ) ;
3428
+ for meta in attr. meta_item_list ( ) ? {
3429
+ match meta. literal ( ) ?. kind {
3430
+ LitKind :: Int ( a, _) => ret. push ( a as usize ) ,
3431
+ _ => panic ! ( "invalid arg index" ) ,
3434
3432
}
3435
- Some ( ret)
3436
- } ;
3437
-
3438
- // Cache the lookup to avoid parsing attributes for an iterm
3439
- // multiple times.
3440
- let ret = parse_attrs ( ) ;
3441
- self . legacy_const_generic_args . insert ( def_id, ret. clone ( ) ) ;
3442
- return ret;
3433
+ }
3434
+ // Cache the lookup to avoid parsing attributes for an iterm multiple times.
3435
+ self . legacy_const_generic_args . insert ( def_id, Some ( ret. clone ( ) ) ) ;
3436
+ return Some ( ret) ;
3443
3437
}
3444
3438
}
3445
3439
None
You can’t perform that action at this time.
0 commit comments