@@ -990,6 +990,9 @@ impl EncodeContext<'a, 'tcx> {
990
990
record ! ( self . tables. ty[ def_id] <- ty) ;
991
991
}
992
992
}
993
+ if let Ok ( sig) = tcx. try_fn_sig ( def_id) {
994
+ record ! ( self . tables. fn_sig[ def_id] <- sig) ;
995
+ }
993
996
}
994
997
let inherent_impls = tcx. crate_inherent_impls ( LOCAL_CRATE ) ;
995
998
for ( def_id, implementations) in inherent_impls. inherent_impls . iter ( ) {
@@ -1005,7 +1008,6 @@ impl EncodeContext<'a, 'tcx> {
1005
1008
}
1006
1009
1007
1010
fn encode_enum_variant_info ( & mut self , def : & ty:: AdtDef , index : VariantIdx ) {
1008
- let tcx = self . tcx ;
1009
1011
let variant = & def. variants [ index] ;
1010
1012
let def_id = variant. def_id ;
1011
1013
debug ! ( "EncodeContext::encode_enum_variant_info({:?})" , def_id) ;
@@ -1023,16 +1025,9 @@ impl EncodeContext<'a, 'tcx> {
1023
1025
f. did. index
1024
1026
} ) ) ;
1025
1027
self . encode_ident_span ( def_id, variant. ident ) ;
1026
- if variant. ctor_kind == CtorKind :: Fn {
1027
- // FIXME(eddyb) encode signature only in `encode_enum_variant_ctor`.
1028
- if let Some ( ctor_def_id) = variant. ctor_def_id {
1029
- record ! ( self . tables. fn_sig[ def_id] <- tcx. fn_sig( ctor_def_id) ) ;
1030
- }
1031
- }
1032
1028
}
1033
1029
1034
1030
fn encode_enum_variant_ctor ( & mut self , def : & ty:: AdtDef , index : VariantIdx ) {
1035
- let tcx = self . tcx ;
1036
1031
let variant = & def. variants [ index] ;
1037
1032
let def_id = variant. ctor_def_id . unwrap ( ) ;
1038
1033
debug ! ( "EncodeContext::encode_enum_variant_ctor({:?})" , def_id) ;
@@ -1046,9 +1041,6 @@ impl EncodeContext<'a, 'tcx> {
1046
1041
} ;
1047
1042
1048
1043
record ! ( self . tables. kind[ def_id] <- EntryKind :: Variant ( self . lazy( data) ) ) ;
1049
- if variant. ctor_kind == CtorKind :: Fn {
1050
- record ! ( self . tables. fn_sig[ def_id] <- tcx. fn_sig( def_id) ) ;
1051
- }
1052
1044
}
1053
1045
1054
1046
fn encode_info_for_mod ( & mut self , local_def_id : LocalDefId , md : & hir:: Mod < ' _ > ) {
@@ -1110,7 +1102,6 @@ impl EncodeContext<'a, 'tcx> {
1110
1102
1111
1103
fn encode_struct_ctor ( & mut self , adt_def : & ty:: AdtDef , def_id : DefId ) {
1112
1104
debug ! ( "EncodeContext::encode_struct_ctor({:?})" , def_id) ;
1113
- let tcx = self . tcx ;
1114
1105
let variant = adt_def. non_enum_variant ( ) ;
1115
1106
1116
1107
let data = VariantData {
@@ -1121,9 +1112,6 @@ impl EncodeContext<'a, 'tcx> {
1121
1112
} ;
1122
1113
1123
1114
record ! ( self . tables. kind[ def_id] <- EntryKind :: Struct ( self . lazy( data) , adt_def. repr) ) ;
1124
- if variant. ctor_kind == CtorKind :: Fn {
1125
- record ! ( self . tables. fn_sig[ def_id] <- tcx. fn_sig( def_id) ) ;
1126
- }
1127
1115
}
1128
1116
1129
1117
fn encode_explicit_item_bounds ( & mut self , def_id : DefId ) {
@@ -1188,15 +1176,10 @@ impl EncodeContext<'a, 'tcx> {
1188
1176
}
1189
1177
}
1190
1178
self . encode_ident_span ( def_id, ast_item. ident ) ;
1191
- if trait_item. kind == ty:: AssocKind :: Fn {
1192
- record ! ( self . tables. fn_sig[ def_id] <- tcx. fn_sig( def_id) ) ;
1193
- }
1194
1179
}
1195
1180
1196
1181
fn encode_info_for_impl_item ( & mut self , def_id : DefId ) {
1197
1182
debug ! ( "EncodeContext::encode_info_for_impl_item({:?})" , def_id) ;
1198
- let tcx = self . tcx ;
1199
-
1200
1183
let hir_id = self . tcx . hir ( ) . local_def_id_to_hir_id ( def_id. expect_local ( ) ) ;
1201
1184
let ast_item = self . tcx . hir ( ) . expect_impl_item ( hir_id) ;
1202
1185
let impl_item = self . tcx . associated_item ( def_id) ;
@@ -1244,9 +1227,6 @@ impl EncodeContext<'a, 'tcx> {
1244
1227
}
1245
1228
}
1246
1229
self . encode_ident_span ( def_id, impl_item. ident ) ;
1247
- if impl_item. kind == ty:: AssocKind :: Fn {
1248
- record ! ( self . tables. fn_sig[ def_id] <- tcx. fn_sig( def_id) ) ;
1249
- }
1250
1230
}
1251
1231
1252
1232
fn encode_fn_param_names_for_body ( & mut self , body_id : hir:: BodyId ) -> Lazy < [ Ident ] > {
@@ -1343,8 +1323,6 @@ impl EncodeContext<'a, 'tcx> {
1343
1323
}
1344
1324
1345
1325
fn encode_info_for_item ( & mut self , def_id : DefId , item : & ' tcx hir:: Item < ' tcx > ) {
1346
- let tcx = self . tcx ;
1347
-
1348
1326
debug ! ( "EncodeContext::encode_info_for_item({:?})" , def_id) ;
1349
1327
1350
1328
self . encode_ident_span ( def_id, item. ident ) ;
@@ -1491,9 +1469,6 @@ impl EncodeContext<'a, 'tcx> {
1491
1469
}
1492
1470
_ => { }
1493
1471
}
1494
- if let hir:: ItemKind :: Fn ( ..) = item. kind {
1495
- record ! ( self . tables. fn_sig[ def_id] <- tcx. fn_sig( def_id) ) ;
1496
- }
1497
1472
if let hir:: ItemKind :: Impl { .. } = item. kind {
1498
1473
if let Some ( trait_ref) = self . tcx . impl_trait_ref ( def_id) {
1499
1474
record ! ( self . tables. impl_trait_ref[ def_id] <- trait_ref) ;
@@ -1532,9 +1507,6 @@ impl EncodeContext<'a, 'tcx> {
1532
1507
1533
1508
_ => bug ! ( "closure that is neither generator nor closure" ) ,
1534
1509
}
1535
- if let ty:: Closure ( def_id, substs) = * ty. kind ( ) {
1536
- record ! ( self . tables. fn_sig[ def_id] <- substs. as_closure( ) . sig( ) ) ;
1537
- }
1538
1510
}
1539
1511
1540
1512
fn encode_info_for_anon_const ( & mut self , def_id : LocalDefId ) {
@@ -1792,8 +1764,6 @@ impl EncodeContext<'a, 'tcx> {
1792
1764
}
1793
1765
1794
1766
fn encode_info_for_foreign_item ( & mut self , def_id : DefId , nitem : & hir:: ForeignItem < ' _ > ) {
1795
- let tcx = self . tcx ;
1796
-
1797
1767
debug ! ( "EncodeContext::encode_info_for_foreign_item({:?})" , def_id) ;
1798
1768
1799
1769
match nitem. kind {
@@ -1820,9 +1790,6 @@ impl EncodeContext<'a, 'tcx> {
1820
1790
}
1821
1791
}
1822
1792
self . encode_ident_span ( def_id, nitem. ident ) ;
1823
- if let hir:: ForeignItemKind :: Fn ( ..) = nitem. kind {
1824
- record ! ( self . tables. fn_sig[ def_id] <- tcx. fn_sig( def_id) ) ;
1825
- }
1826
1793
}
1827
1794
}
1828
1795
0 commit comments