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 @@ -417,16 +417,12 @@ impl CStore {
417
417
418
418
let span = data. get_span ( id. index , sess) ;
419
419
420
- let attrs = data. get_item_attrs ( id. index , sess) . collect ( ) ;
421
-
422
- let ident = data. item_ident ( id. index , sess) ;
423
-
424
420
LoadedMacro :: MacroDef (
425
421
ast:: Item {
426
- ident,
422
+ ident : data . item_ident ( id . index , sess ) ,
427
423
id : ast:: DUMMY_NODE_ID ,
428
424
span,
429
- attrs,
425
+ attrs : data . get_item_attrs ( id . index , sess ) . collect ( ) ,
430
426
kind : ast:: ItemKind :: MacroDef ( data. get_macro ( id. index , sess) ) ,
431
427
vis : ast:: Visibility {
432
428
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