@@ -939,37 +939,12 @@ impl<'a, 'gcx, 'tcx> Generics {
939
939
}
940
940
}
941
941
942
- pub fn region_param ( & ' tcx self ,
943
- param : & EarlyBoundRegion ,
944
- tcx : TyCtxt < ' a , ' gcx , ' tcx > )
945
- -> & ' tcx GenericParamDef
946
- {
947
- if let Some ( index) = param. index . checked_sub ( self . parent_count as u32 ) {
948
- let param = & self . params [ index as usize ] ;
949
- match param. kind {
950
- ty:: GenericParamDefKind :: Lifetime => param,
951
- _ => bug ! ( "expected lifetime parameter, but found another generic parameter" )
952
- }
953
- } else {
954
- tcx. generics_of ( self . parent . expect ( "parent_count>0 but no parent?" ) )
955
- . region_param ( param, tcx)
956
- }
957
- }
958
-
959
- /// Returns the `GenericParamDef` associated with this `ParamTy`.
960
- pub fn type_param ( & ' tcx self ,
961
- param : & ParamTy ,
962
- tcx : TyCtxt < ' a , ' gcx , ' tcx > )
963
- -> & ' tcx GenericParamDef {
964
- if let Some ( index) = param. idx . checked_sub ( self . parent_count as u32 ) {
965
- let param = & self . params [ index as usize ] ;
966
- match param. kind {
967
- ty:: GenericParamDefKind :: Type { ..} => param,
968
- _ => bug ! ( "expected type parameter, but found another generic parameter" )
969
- }
942
+ pub fn param_at ( & ' tcx self , index : u32 , tcx : TyCtxt < ' _ , ' _ , ' tcx > ) -> & ' tcx GenericParamDef {
943
+ if let Some ( index) = index. checked_sub ( self . parent_count as u32 ) {
944
+ & self . params [ index as usize ]
970
945
} else {
971
946
tcx. generics_of ( self . parent . expect ( "parent_count>0 but no parent?" ) )
972
- . type_param ( param , tcx)
947
+ . param_at ( index , tcx)
973
948
}
974
949
}
975
950
}
0 commit comments