1
1
use crate :: rmeta:: table:: { FixedSizeEncoding , TableBuilder } ;
2
2
use crate :: rmeta:: * ;
3
3
4
- use rustc_ast as ast;
5
4
use rustc_data_structures:: fingerprint:: { Fingerprint , FingerprintEncoder } ;
6
5
use rustc_data_structures:: fx:: { FxHashMap , FxHashSet , FxIndexSet } ;
7
6
use rustc_data_structures:: stable_hasher:: StableHasher ;
@@ -437,7 +436,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
437
436
438
437
fn encode_info_for_items ( & mut self ) {
439
438
let krate = self . tcx . hir ( ) . krate ( ) ;
440
- self . encode_info_for_mod ( hir:: CRATE_HIR_ID , & krate. item . module , & krate . item . attrs ) ;
439
+ self . encode_info_for_mod ( hir:: CRATE_HIR_ID , & krate. item . module ) ;
441
440
442
441
// Proc-macro crates only export proc-macro items, which are looked
443
442
// up using `proc_macro_data`
@@ -769,6 +768,7 @@ impl EncodeContext<'a, 'tcx> {
769
768
def_kind => def_kind,
770
769
} ) ;
771
770
record ! ( self . tables. span[ def_id] <- tcx. def_span( def_id) ) ;
771
+ record ! ( self . tables. attributes[ def_id] <- tcx. get_attrs( def_id) ) ;
772
772
if should_encode_visibility ( def_kind) {
773
773
record ! ( self . tables. visibility[ def_id] <- self . tcx. visibility( def_id) ) ;
774
774
}
@@ -799,7 +799,6 @@ impl EncodeContext<'a, 'tcx> {
799
799
} ;
800
800
801
801
record ! ( self . tables. kind[ def_id] <- EntryKind :: Variant ( self . lazy( data) ) ) ;
802
- record ! ( self . tables. attributes[ def_id] <- & self . tcx. get_attrs( def_id) [ ..] ) ;
803
802
record ! ( self . tables. expn_that_defined[ def_id] <- self . tcx. expansion_that_defined( def_id) ) ;
804
803
record ! ( self . tables. children[ def_id] <- variant. fields. iter( ) . map( |f| {
805
804
assert!( f. did. is_local( ) ) ;
@@ -854,7 +853,7 @@ impl EncodeContext<'a, 'tcx> {
854
853
self . encode_mir_for_ctfe ( def_id. expect_local ( ) ) ;
855
854
}
856
855
857
- fn encode_info_for_mod ( & mut self , id : hir:: HirId , md : & hir:: Mod < ' _ > , attrs : & [ ast :: Attribute ] ) {
856
+ fn encode_info_for_mod ( & mut self , id : hir:: HirId , md : & hir:: Mod < ' _ > ) {
858
857
let tcx = self . tcx ;
859
858
let local_def_id = tcx. hir ( ) . local_def_id ( id) ;
860
859
let def_id = local_def_id. to_def_id ( ) ;
@@ -887,7 +886,6 @@ impl EncodeContext<'a, 'tcx> {
887
886
} ;
888
887
889
888
record ! ( self . tables. kind[ def_id] <- EntryKind :: Mod ( self . lazy( data) ) ) ;
890
- record ! ( self . tables. attributes[ def_id] <- attrs) ;
891
889
if self . is_proc_macro {
892
890
record ! ( self . tables. children[ def_id] <- & [ ] ) ;
893
891
} else {
@@ -905,18 +903,13 @@ impl EncodeContext<'a, 'tcx> {
905
903
variant_index : VariantIdx ,
906
904
field_index : usize ,
907
905
) {
908
- let tcx = self . tcx ;
909
906
let variant = & adt_def. variants [ variant_index] ;
910
907
let field = & variant. fields [ field_index] ;
911
908
912
909
let def_id = field. did ;
913
910
debug ! ( "EncodeContext::encode_field({:?})" , def_id) ;
914
911
915
- let variant_id = tcx. hir ( ) . local_def_id_to_hir_id ( variant. def_id . expect_local ( ) ) ;
916
- let variant_data = tcx. hir ( ) . expect_variant_data ( variant_id) ;
917
-
918
912
record ! ( self . tables. kind[ def_id] <- EntryKind :: Field ) ;
919
- record ! ( self . tables. attributes[ def_id] <- variant_data. fields( ) [ field_index] . attrs) ;
920
913
record ! ( self . tables. expn_that_defined[ def_id] <- self . tcx. expansion_that_defined( def_id) ) ;
921
914
self . encode_ident_span ( def_id, field. ident ) ;
922
915
self . encode_stability ( def_id) ;
@@ -1043,7 +1036,6 @@ impl EncodeContext<'a, 'tcx> {
1043
1036
record ! ( self . tables. kind[ def_id] <- EntryKind :: AssocType ( container) ) ;
1044
1037
}
1045
1038
}
1046
- record ! ( self . tables. attributes[ def_id] <- ast_item. attrs) ;
1047
1039
self . encode_ident_span ( def_id, ast_item. ident ) ;
1048
1040
self . encode_stability ( def_id) ;
1049
1041
self . encode_const_stability ( def_id) ;
@@ -1145,7 +1137,6 @@ impl EncodeContext<'a, 'tcx> {
1145
1137
record ! ( self . tables. kind[ def_id] <- EntryKind :: AssocType ( container) ) ;
1146
1138
}
1147
1139
}
1148
- record ! ( self . tables. attributes[ def_id] <- ast_item. attrs) ;
1149
1140
self . encode_ident_span ( def_id, impl_item. ident ) ;
1150
1141
self . encode_stability ( def_id) ;
1151
1142
self . encode_const_stability ( def_id) ;
@@ -1296,7 +1287,7 @@ impl EncodeContext<'a, 'tcx> {
1296
1287
EntryKind :: Fn ( self . lazy ( data) )
1297
1288
}
1298
1289
hir:: ItemKind :: Mod ( ref m) => {
1299
- return self . encode_info_for_mod ( item. hir_id , m, & item . attrs ) ;
1290
+ return self . encode_info_for_mod ( item. hir_id , m) ;
1300
1291
}
1301
1292
hir:: ItemKind :: ForeignMod { .. } => EntryKind :: ForeignMod ,
1302
1293
hir:: ItemKind :: GlobalAsm ( ..) => EntryKind :: GlobalAsm ,
@@ -1389,7 +1380,6 @@ impl EncodeContext<'a, 'tcx> {
1389
1380
}
1390
1381
} ;
1391
1382
record ! ( self . tables. kind[ def_id] <- entry_kind) ;
1392
- record ! ( self . tables. attributes[ def_id] <- item. attrs) ;
1393
1383
record ! ( self . tables. expn_that_defined[ def_id] <- self . tcx. expansion_that_defined( def_id) ) ;
1394
1384
// FIXME(eddyb) there should be a nicer way to do this.
1395
1385
match item. kind {
@@ -1507,7 +1497,6 @@ impl EncodeContext<'a, 'tcx> {
1507
1497
fn encode_info_for_macro_def ( & mut self , macro_def : & hir:: MacroDef < ' _ > ) {
1508
1498
let def_id = self . tcx . hir ( ) . local_def_id ( macro_def. hir_id ) . to_def_id ( ) ;
1509
1499
record ! ( self . tables. kind[ def_id] <- EntryKind :: MacroDef ( self . lazy( macro_def. ast. clone( ) ) ) ) ;
1510
- record ! ( self . tables. attributes[ def_id] <- macro_def. attrs) ;
1511
1500
self . encode_ident_span ( def_id, macro_def. ident ) ;
1512
1501
self . encode_stability ( def_id) ;
1513
1502
self . encode_deprecation ( def_id) ;
@@ -1540,7 +1529,6 @@ impl EncodeContext<'a, 'tcx> {
1540
1529
1541
1530
_ => bug ! ( "closure that is neither generator nor closure" ) ,
1542
1531
}
1543
- record ! ( self . tables. attributes[ def_id. to_def_id( ) ] <- & self . tcx. get_attrs( def_id. to_def_id( ) ) [ ..] ) ;
1544
1532
self . encode_item_type ( def_id. to_def_id ( ) ) ;
1545
1533
if let ty:: Closure ( def_id, substs) = * ty. kind ( ) {
1546
1534
record ! ( self . tables. fn_sig[ def_id] <- substs. as_closure( ) . sig( ) ) ;
@@ -1837,7 +1825,6 @@ impl EncodeContext<'a, 'tcx> {
1837
1825
record ! ( self . tables. kind[ def_id] <- EntryKind :: ForeignType ) ;
1838
1826
}
1839
1827
}
1840
- record ! ( self . tables. attributes[ def_id] <- nitem. attrs) ;
1841
1828
self . encode_ident_span ( def_id, nitem. ident ) ;
1842
1829
self . encode_stability ( def_id) ;
1843
1830
self . encode_const_stability ( def_id) ;
0 commit comments