@@ -1308,26 +1308,22 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
1308
1308
}
1309
1309
}
1310
1310
1311
- fn encode_info_for_ty_in_generic_param (
1311
+ fn encode_info_for_generic_param (
1312
1312
& mut self ,
1313
- ( def_id, Untracked ( encode_type) ) : ( DefId , Untracked < bool > ) ,
1313
+ def_id : DefId ,
1314
+ entry_kind : EntryKind < ' tcx > ,
1315
+ encode_type : bool ,
1314
1316
) -> Entry < ' tcx > {
1315
- debug ! ( "IsolatedEncoder::encode_info_for_ty_in_generic_param({:?})" , def_id) ;
1316
1317
let tcx = self . tcx ;
1317
1318
Entry {
1318
- kind : EntryKind :: Type ,
1319
+ kind : entry_kind ,
1319
1320
visibility : self . lazy ( & ty:: Visibility :: Public ) ,
1320
1321
span : self . lazy ( & tcx. def_span ( def_id) ) ,
1321
1322
attributes : LazySeq :: empty ( ) ,
1322
1323
children : LazySeq :: empty ( ) ,
1323
1324
stability : None ,
1324
1325
deprecation : None ,
1325
-
1326
- ty : if encode_type {
1327
- Some ( self . encode_item_type ( def_id) )
1328
- } else {
1329
- None
1330
- } ,
1326
+ ty : if encode_type { Some ( self . encode_item_type ( def_id) ) } else { None } ,
1331
1327
inherent_impls : LazySeq :: empty ( ) ,
1332
1328
variances : LazySeq :: empty ( ) ,
1333
1329
generics : None ,
@@ -1338,6 +1334,22 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
1338
1334
}
1339
1335
}
1340
1336
1337
+ fn encode_info_for_ty_param (
1338
+ & mut self ,
1339
+ ( def_id, Untracked ( encode_type) ) : ( DefId , Untracked < bool > ) ,
1340
+ ) -> Entry < ' tcx > {
1341
+ debug ! ( "IsolatedEncoder::encode_info_for_ty_param({:?})" , def_id) ;
1342
+ self . encode_info_for_generic_param ( def_id, EntryKind :: TypeParam , encode_type)
1343
+ }
1344
+
1345
+ fn encode_info_for_const_param (
1346
+ & mut self ,
1347
+ def_id : DefId ,
1348
+ ) -> Entry < ' tcx > {
1349
+ debug ! ( "IsolatedEncoder::encode_info_for_const_param({:?})" , def_id) ;
1350
+ self . encode_info_for_generic_param ( def_id, EntryKind :: ConstParam , true )
1351
+ }
1352
+
1341
1353
fn encode_info_for_closure ( & mut self , def_id : DefId ) -> Entry < ' tcx > {
1342
1354
debug ! ( "IsolatedEncoder::encode_info_for_closure({:?})" , def_id) ;
1343
1355
let tcx = self . tcx ;
@@ -1682,17 +1694,20 @@ impl<'a, 'b, 'tcx> IndexBuilder<'a, 'b, 'tcx> {
1682
1694
1683
1695
fn encode_info_for_generics ( & mut self , generics : & hir:: Generics ) {
1684
1696
for param in & generics. params {
1685
- let encode_type = match param. kind {
1686
- GenericParamKind :: Lifetime { .. } => continue ,
1687
- GenericParamKind :: Type { ref default, .. } => default. is_some ( ) ,
1688
- GenericParamKind :: Const { .. } => true ,
1689
- } ;
1690
1697
let def_id = self . tcx . hir ( ) . local_def_id_from_hir_id ( param. hir_id ) ;
1691
- self . record (
1692
- def_id,
1693
- IsolatedEncoder :: encode_info_for_ty_in_generic_param,
1694
- ( def_id, Untracked ( encode_type) ) ,
1695
- ) ;
1698
+ match param. kind {
1699
+ GenericParamKind :: Lifetime { .. } => continue ,
1700
+ GenericParamKind :: Type { ref default, .. } => {
1701
+ self . record (
1702
+ def_id,
1703
+ IsolatedEncoder :: encode_info_for_ty_param,
1704
+ ( def_id, Untracked ( default. is_some ( ) ) ) ,
1705
+ ) ;
1706
+ }
1707
+ GenericParamKind :: Const { .. } => {
1708
+ self . record ( def_id, IsolatedEncoder :: encode_info_for_const_param, def_id) ;
1709
+ }
1710
+ }
1696
1711
}
1697
1712
}
1698
1713
0 commit comments