@@ -51,16 +51,9 @@ pub trait AstConv<'gcx, 'tcx> {
51
51
/// A cache used for the result of `ast_ty_to_ty_cache`
52
52
fn ast_ty_to_ty_cache ( & self ) -> & RefCell < NodeMap < Ty < ' tcx > > > ;
53
53
54
- /// Returns the generic type and lifetime parameters for an item.
55
- fn get_generics ( & self , id : DefId ) -> & ' tcx ty:: Generics ;
56
-
57
54
/// Identify the type for an item, like a type alias, fn, or struct.
58
55
fn get_item_type ( & self , span : Span , id : DefId ) -> Ty < ' tcx > ;
59
56
60
- /// Returns the `TraitDef` for a given trait. This allows you to
61
- /// figure out the set of type parameters defined on the trait.
62
- fn get_trait_def ( & self , id : DefId ) -> & ' tcx ty:: TraitDef ;
63
-
64
57
/// Ensure that the super-predicates for the trait with the given
65
58
/// id are available and also for the transitive set of
66
59
/// super-predicates.
@@ -248,7 +241,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
248
241
// If the type is parameterized by this region, then replace this
249
242
// region with the current anon region binding (in other words,
250
243
// whatever & would get replaced with).
251
- let decl_generics = self . get_generics ( def_id) ;
244
+ let decl_generics = tcx . item_generics ( def_id) ;
252
245
let expected_num_region_params = decl_generics. regions . len ( ) ;
253
246
let supplied_num_region_params = lifetimes. len ( ) ;
254
247
if expected_num_region_params != supplied_num_region_params {
@@ -485,7 +478,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
485
478
debug ! ( "create_substs_for_ast_trait_ref(trait_segment={:?})" ,
486
479
trait_segment) ;
487
480
488
- let trait_def = self . get_trait_def ( trait_def_id) ;
481
+ let trait_def = self . tcx ( ) . lookup_trait_def ( trait_def_id) ;
489
482
490
483
match trait_segment. parameters {
491
484
hir:: AngleBracketedParameters ( _) => {
@@ -1019,7 +1012,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
1019
1012
let node_id = tcx. hir . as_local_node_id ( did) . unwrap ( ) ;
1020
1013
let item_id = tcx. hir . get_parent_node ( node_id) ;
1021
1014
let item_def_id = tcx. hir . local_def_id ( item_id) ;
1022
- let generics = self . get_generics ( item_def_id) ;
1015
+ let generics = tcx . item_generics ( item_def_id) ;
1023
1016
let index = generics. type_param_to_index [ & tcx. hir . local_def_id ( node_id) . index ] ;
1024
1017
tcx. mk_param ( index, tcx. hir . name ( node_id) )
1025
1018
}
@@ -1186,7 +1179,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
1186
1179
// Create the anonymized type.
1187
1180
if allow {
1188
1181
let def_id = tcx. hir . local_def_id ( ast_ty. id ) ;
1189
- self . get_generics ( def_id) ;
1182
+ tcx . item_generics ( def_id) ;
1190
1183
let substs = Substs :: identity_for_item ( tcx, def_id) ;
1191
1184
let ty = tcx. mk_anon ( tcx. hir . local_def_id ( ast_ty. id ) , substs) ;
1192
1185
0 commit comments