@@ -295,7 +295,7 @@ impl AstConv<'tcx> for ItemCtxt<'tcx> {
295
295
}
296
296
297
297
fn get_type_parameter_bounds ( & self , span : Span , def_id : DefId ) -> ty:: GenericPredicates < ' tcx > {
298
- self . tcx . at ( span) . type_param_predicates ( ( self . item_def_id , def_id) )
298
+ self . tcx . at ( span) . type_param_predicates ( ( self . item_def_id , def_id. expect_local ( ) ) )
299
299
}
300
300
301
301
fn re_infer ( & self , _: Option < & ty:: GenericParamDef > , _: Span ) -> Option < ty:: Region < ' tcx > > {
@@ -478,19 +478,19 @@ fn get_new_lifetime_name<'tcx>(
478
478
/// `X: Foo` where `X` is the type parameter `def_id`.
479
479
fn type_param_predicates (
480
480
tcx : TyCtxt < ' _ > ,
481
- ( item_def_id, def_id) : ( DefId , DefId ) ,
481
+ ( item_def_id, def_id) : ( DefId , LocalDefId ) ,
482
482
) -> ty:: GenericPredicates < ' _ > {
483
483
use rustc_hir:: * ;
484
484
485
485
// In the AST, bounds can derive from two places. Either
486
486
// written inline like `<T: Foo>` or in a where-clause like
487
487
// `where T: Foo`.
488
488
489
- let param_id = tcx. hir ( ) . as_local_hir_id ( def_id. expect_local ( ) ) ;
489
+ let param_id = tcx. hir ( ) . as_local_hir_id ( def_id) ;
490
490
let param_owner = tcx. hir ( ) . ty_param_owner ( param_id) ;
491
491
let param_owner_def_id = tcx. hir ( ) . local_def_id ( param_owner) ;
492
492
let generics = tcx. generics_of ( param_owner_def_id) ;
493
- let index = generics. param_def_id_to_index [ & def_id] ;
493
+ let index = generics. param_def_id_to_index [ & def_id. to_def_id ( ) ] ;
494
494
let ty = tcx. mk_ty_param ( index, tcx. hir ( ) . ty_param_name ( param_id) ) ;
495
495
496
496
// Don't look for bounds where the type parameter isn't in scope.
@@ -503,7 +503,7 @@ fn type_param_predicates(
503
503
let mut result = parent
504
504
. map ( |parent| {
505
505
let icx = ItemCtxt :: new ( tcx, parent) ;
506
- icx. get_type_parameter_bounds ( DUMMY_SP , def_id)
506
+ icx. get_type_parameter_bounds ( DUMMY_SP , def_id. to_def_id ( ) )
507
507
} )
508
508
. unwrap_or_default ( ) ;
509
509
let mut extend = None ;
0 commit comments