@@ -7,6 +7,7 @@ use rustc::middle::cstore::{LinkagePreference, NativeLibrary,
7
7
EncodedMetadata , ForeignModule } ;
8
8
use rustc:: hir:: def:: CtorKind ;
9
9
use rustc:: hir:: def_id:: { CrateNum , CRATE_DEF_INDEX , DefIndex , DefId , LocalDefId , LOCAL_CRATE } ;
10
+ use rustc:: hir:: GenericParamKind ;
10
11
use rustc:: hir:: map:: definitions:: DefPathTable ;
11
12
use rustc_data_structures:: fingerprint:: Fingerprint ;
12
13
use rustc:: middle:: dependency_format:: Linkage ;
@@ -1307,10 +1308,11 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
1307
1308
}
1308
1309
}
1309
1310
1310
- fn encode_info_for_ty_param ( & mut self ,
1311
- ( def_id, Untracked ( has_default) ) : ( DefId , Untracked < bool > ) )
1312
- -> Entry < ' tcx > {
1313
- debug ! ( "IsolatedEncoder::encode_info_for_ty_param({:?})" , def_id) ;
1311
+ fn encode_info_for_generic_param (
1312
+ & mut self ,
1313
+ ( def_id, Untracked ( encode_type) ) : ( DefId , Untracked < bool > ) ,
1314
+ ) -> Entry < ' tcx > {
1315
+ debug ! ( "IsolatedEncoder::encode_info_for_generic_param({:?})" , def_id) ;
1314
1316
let tcx = self . tcx ;
1315
1317
Entry {
1316
1318
kind : EntryKind :: Type ,
@@ -1321,7 +1323,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
1321
1323
stability : None ,
1322
1324
deprecation : None ,
1323
1325
1324
- ty : if has_default {
1326
+ ty : if encode_type {
1325
1327
Some ( self . encode_item_type ( def_id) )
1326
1328
} else {
1327
1329
None
@@ -1336,29 +1338,6 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
1336
1338
}
1337
1339
}
1338
1340
1339
- fn encode_info_for_const_param ( & mut self , def_id : DefId ) -> Entry < ' tcx > {
1340
- debug ! ( "IsolatedEncoder::encode_info_for_const_param({:?})" , def_id) ;
1341
- let tcx = self . tcx ;
1342
- Entry {
1343
- kind : EntryKind :: Type ,
1344
- visibility : self . lazy ( & ty:: Visibility :: Public ) ,
1345
- span : self . lazy ( & tcx. def_span ( def_id) ) ,
1346
- attributes : LazySeq :: empty ( ) ,
1347
- children : LazySeq :: empty ( ) ,
1348
- stability : None ,
1349
- deprecation : None ,
1350
-
1351
- ty : Some ( self . encode_item_type ( def_id) ) ,
1352
- inherent_impls : LazySeq :: empty ( ) ,
1353
- variances : LazySeq :: empty ( ) ,
1354
- generics : None ,
1355
- predicates : None ,
1356
- predicates_defined_on : None ,
1357
-
1358
- mir : None ,
1359
- }
1360
- }
1361
-
1362
1341
fn encode_info_for_closure ( & mut self , def_id : DefId ) -> Entry < ' tcx > {
1363
1342
debug ! ( "IsolatedEncoder::encode_info_for_closure({:?})" , def_id) ;
1364
1343
let tcx = self . tcx ;
@@ -1703,20 +1682,17 @@ impl<'a, 'b, 'tcx> IndexBuilder<'a, 'b, 'tcx> {
1703
1682
1704
1683
fn encode_info_for_generics ( & mut self , generics : & hir:: Generics ) {
1705
1684
for param in & generics. params {
1706
- match param. kind {
1707
- hir:: GenericParamKind :: Lifetime { .. } => { }
1708
- hir:: GenericParamKind :: Type { ref default, .. } => {
1709
- let def_id = self . tcx . hir ( ) . local_def_id_from_hir_id ( param. hir_id ) ;
1710
- let has_default = Untracked ( default. is_some ( ) ) ;
1711
- let encode_info = IsolatedEncoder :: encode_info_for_ty_param;
1712
- self . record ( def_id, encode_info, ( def_id, has_default) ) ;
1713
- }
1714
- hir:: GenericParamKind :: Const { .. } => {
1715
- let def_id = self . tcx . hir ( ) . local_def_id_from_hir_id ( param. hir_id ) ;
1716
- let encode_info = IsolatedEncoder :: encode_info_for_const_param;
1717
- self . record ( def_id, encode_info, def_id) ;
1718
- }
1719
- }
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
+ 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_generic_param,
1694
+ ( def_id, Untracked ( encode_type) ) ,
1695
+ ) ;
1720
1696
}
1721
1697
}
1722
1698
0 commit comments