@@ -1308,26 +1308,22 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
13081308 }
13091309 }
13101310
1311- fn encode_info_for_ty_in_generic_param (
1311+ fn encode_info_for_generic_param (
13121312 & mut self ,
1313- ( def_id, Untracked ( encode_type) ) : ( DefId , Untracked < bool > ) ,
1313+ def_id : DefId ,
1314+ entry_kind : EntryKind < ' tcx > ,
1315+ encode_type : bool ,
13141316 ) -> Entry < ' tcx > {
1315- debug ! ( "IsolatedEncoder::encode_info_for_ty_in_generic_param({:?})" , def_id) ;
13161317 let tcx = self . tcx ;
13171318 Entry {
1318- kind : EntryKind :: Type ,
1319+ kind : entry_kind ,
13191320 visibility : self . lazy ( & ty:: Visibility :: Public ) ,
13201321 span : self . lazy ( & tcx. def_span ( def_id) ) ,
13211322 attributes : LazySeq :: empty ( ) ,
13221323 children : LazySeq :: empty ( ) ,
13231324 stability : None ,
13241325 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 } ,
13311327 inherent_impls : LazySeq :: empty ( ) ,
13321328 variances : LazySeq :: empty ( ) ,
13331329 generics : None ,
@@ -1338,6 +1334,22 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
13381334 }
13391335 }
13401336
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+
13411353 fn encode_info_for_closure ( & mut self , def_id : DefId ) -> Entry < ' tcx > {
13421354 debug ! ( "IsolatedEncoder::encode_info_for_closure({:?})" , def_id) ;
13431355 let tcx = self . tcx ;
@@ -1682,17 +1694,20 @@ impl<'a, 'b, 'tcx> IndexBuilder<'a, 'b, 'tcx> {
16821694
16831695 fn encode_info_for_generics ( & mut self , generics : & hir:: Generics ) {
16841696 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- } ;
16901697 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+ }
16961711 }
16971712 }
16981713
0 commit comments