@@ -950,6 +950,9 @@ impl EncodeContext<'a, 'tcx> {
950
950
if let DefKind :: Trait | DefKind :: TraitAlias = def_kind {
951
951
record ! ( self . tables. super_predicates[ def_id] <- self . tcx. super_predicates_of( def_id) ) ;
952
952
}
953
+ if let Ok ( ty) = self . tcx . try_type_of ( def_id) {
954
+ record ! ( self . tables. ty[ def_id] <- ty) ;
955
+ }
953
956
}
954
957
let inherent_impls = tcx. crate_inherent_impls ( LOCAL_CRATE ) ;
955
958
for ( def_id, implementations) in inherent_impls. inherent_impls . iter ( ) {
@@ -964,11 +967,6 @@ impl EncodeContext<'a, 'tcx> {
964
967
}
965
968
}
966
969
967
- fn encode_item_type ( & mut self , def_id : DefId ) {
968
- debug ! ( "EncodeContext::encode_item_type({:?})" , def_id) ;
969
- record ! ( self . tables. ty[ def_id] <- self . tcx. type_of( def_id) ) ;
970
- }
971
-
972
970
fn encode_enum_variant_info ( & mut self , def : & ty:: AdtDef , index : VariantIdx ) {
973
971
let tcx = self . tcx ;
974
972
let variant = & def. variants [ index] ;
@@ -988,7 +986,6 @@ impl EncodeContext<'a, 'tcx> {
988
986
f. did. index
989
987
} ) ) ;
990
988
self . encode_ident_span ( def_id, variant. ident ) ;
991
- self . encode_item_type ( def_id) ;
992
989
if variant. ctor_kind == CtorKind :: Fn {
993
990
// FIXME(eddyb) encode signature only in `encode_enum_variant_ctor`.
994
991
if let Some ( ctor_def_id) = variant. ctor_def_id {
@@ -1012,7 +1009,6 @@ impl EncodeContext<'a, 'tcx> {
1012
1009
} ;
1013
1010
1014
1011
record ! ( self . tables. kind[ def_id] <- EntryKind :: Variant ( self . lazy( data) ) ) ;
1015
- self . encode_item_type ( def_id) ;
1016
1012
if variant. ctor_kind == CtorKind :: Fn {
1017
1013
record ! ( self . tables. fn_sig[ def_id] <- tcx. fn_sig( def_id) ) ;
1018
1014
}
@@ -1073,7 +1069,6 @@ impl EncodeContext<'a, 'tcx> {
1073
1069
1074
1070
record ! ( self . tables. kind[ def_id] <- EntryKind :: Field ) ;
1075
1071
self . encode_ident_span ( def_id, field. ident ) ;
1076
- self . encode_item_type ( def_id) ;
1077
1072
}
1078
1073
1079
1074
fn encode_struct_ctor ( & mut self , adt_def : & ty:: AdtDef , def_id : DefId ) {
@@ -1089,7 +1084,6 @@ impl EncodeContext<'a, 'tcx> {
1089
1084
} ;
1090
1085
1091
1086
record ! ( self . tables. kind[ def_id] <- EntryKind :: Struct ( self . lazy( data) , adt_def. repr) ) ;
1092
- self . encode_item_type ( def_id) ;
1093
1087
if variant. ctor_kind == CtorKind :: Fn {
1094
1088
record ! ( self . tables. fn_sig[ def_id] <- tcx. fn_sig( def_id) ) ;
1095
1089
}
@@ -1157,16 +1151,6 @@ impl EncodeContext<'a, 'tcx> {
1157
1151
}
1158
1152
}
1159
1153
self . encode_ident_span ( def_id, ast_item. ident ) ;
1160
- match trait_item. kind {
1161
- ty:: AssocKind :: Const | ty:: AssocKind :: Fn => {
1162
- self . encode_item_type ( def_id) ;
1163
- }
1164
- ty:: AssocKind :: Type => {
1165
- if trait_item. defaultness . has_value ( ) {
1166
- self . encode_item_type ( def_id) ;
1167
- }
1168
- }
1169
- }
1170
1154
if trait_item. kind == ty:: AssocKind :: Fn {
1171
1155
record ! ( self . tables. fn_sig[ def_id] <- tcx. fn_sig( def_id) ) ;
1172
1156
}
@@ -1223,7 +1207,6 @@ impl EncodeContext<'a, 'tcx> {
1223
1207
}
1224
1208
}
1225
1209
self . encode_ident_span ( def_id, impl_item. ident ) ;
1226
- self . encode_item_type ( def_id) ;
1227
1210
if impl_item. kind == ty:: AssocKind :: Fn {
1228
1211
record ! ( self . tables. fn_sig[ def_id] <- tcx. fn_sig( def_id) ) ;
1229
1212
}
@@ -1471,18 +1454,6 @@ impl EncodeContext<'a, 'tcx> {
1471
1454
}
1472
1455
_ => { }
1473
1456
}
1474
- match item. kind {
1475
- hir:: ItemKind :: Static ( ..)
1476
- | hir:: ItemKind :: Const ( ..)
1477
- | hir:: ItemKind :: Fn ( ..)
1478
- | hir:: ItemKind :: TyAlias ( ..)
1479
- | hir:: ItemKind :: OpaqueTy ( ..)
1480
- | hir:: ItemKind :: Enum ( ..)
1481
- | hir:: ItemKind :: Struct ( ..)
1482
- | hir:: ItemKind :: Union ( ..)
1483
- | hir:: ItemKind :: Impl { .. } => self . encode_item_type ( def_id) ,
1484
- _ => { }
1485
- }
1486
1457
if let hir:: ItemKind :: Fn ( ..) = item. kind {
1487
1458
record ! ( self . tables. fn_sig[ def_id] <- tcx. fn_sig( def_id) ) ;
1488
1459
}
@@ -1500,11 +1471,8 @@ impl EncodeContext<'a, 'tcx> {
1500
1471
self . encode_ident_span ( def_id, macro_def. ident ) ;
1501
1472
}
1502
1473
1503
- fn encode_info_for_generic_param ( & mut self , def_id : DefId , kind : EntryKind , encode_type : bool ) {
1474
+ fn encode_info_for_generic_param ( & mut self , def_id : DefId , kind : EntryKind ) {
1504
1475
record ! ( self . tables. kind[ def_id] <- kind) ;
1505
- if encode_type {
1506
- self . encode_item_type ( def_id) ;
1507
- }
1508
1476
}
1509
1477
1510
1478
fn encode_info_for_closure ( & mut self , def_id : LocalDefId ) {
@@ -1527,7 +1495,6 @@ impl EncodeContext<'a, 'tcx> {
1527
1495
1528
1496
_ => bug ! ( "closure that is neither generator nor closure" ) ,
1529
1497
}
1530
- self . encode_item_type ( def_id. to_def_id ( ) ) ;
1531
1498
if let ty:: Closure ( def_id, substs) = * ty. kind ( ) {
1532
1499
record ! ( self . tables. fn_sig[ def_id] <- substs. as_closure( ) . sig( ) ) ;
1533
1500
}
@@ -1541,7 +1508,6 @@ impl EncodeContext<'a, 'tcx> {
1541
1508
let qualifs = self . tcx . mir_const_qualif ( def_id) ;
1542
1509
1543
1510
record ! ( self . tables. kind[ def_id. to_def_id( ) ] <- EntryKind :: AnonConst ( qualifs, const_data) ) ;
1544
- self . encode_item_type ( def_id. to_def_id ( ) ) ;
1545
1511
}
1546
1512
1547
1513
fn encode_native_libraries ( & mut self ) -> Lazy < [ NativeLib ] > {
@@ -1817,7 +1783,6 @@ impl EncodeContext<'a, 'tcx> {
1817
1783
}
1818
1784
}
1819
1785
self . encode_ident_span ( def_id, nitem. ident ) ;
1820
- self . encode_item_type ( def_id) ;
1821
1786
if let hir:: ForeignItemKind :: Fn ( ..) = nitem. kind {
1822
1787
record ! ( self . tables. fn_sig[ def_id] <- tcx. fn_sig( def_id) ) ;
1823
1788
}
@@ -1875,19 +1840,11 @@ impl EncodeContext<'a, 'tcx> {
1875
1840
let def_id = self . tcx . hir ( ) . local_def_id ( param. hir_id ) ;
1876
1841
match param. kind {
1877
1842
GenericParamKind :: Lifetime { .. } => continue ,
1878
- GenericParamKind :: Type { default, .. } => {
1879
- self . encode_info_for_generic_param (
1880
- def_id. to_def_id ( ) ,
1881
- EntryKind :: TypeParam ,
1882
- default. is_some ( ) ,
1883
- ) ;
1843
+ GenericParamKind :: Type { .. } => {
1844
+ self . encode_info_for_generic_param ( def_id. to_def_id ( ) , EntryKind :: TypeParam ) ;
1884
1845
}
1885
1846
GenericParamKind :: Const { .. } => {
1886
- self . encode_info_for_generic_param (
1887
- def_id. to_def_id ( ) ,
1888
- EntryKind :: ConstParam ,
1889
- true ,
1890
- ) ;
1847
+ self . encode_info_for_generic_param ( def_id. to_def_id ( ) , EntryKind :: ConstParam ) ;
1891
1848
// FIXME(const_generics_defaults)
1892
1849
}
1893
1850
}
0 commit comments