@@ -295,7 +295,7 @@ pub(crate) fn conv_adt_sort_def(
295295 def_id : MaybeExternId ,
296296 kind : & fhir:: RefinementKind ,
297297) -> QueryResult < rty:: AdtSortDef > {
298- let wfckresults = & WfckResults :: new ( OwnerId { def_id : def_id . local_id ( ) } ) ;
298+ let wfckresults = & WfckResults :: new ( def_id . map ( |def_id| OwnerId { def_id } ) ) ;
299299 let mut cx = AfterSortck :: new ( genv, wfckresults) . into_conv_ctxt ( ) ;
300300 match kind {
301301 fhir:: RefinementKind :: Refined ( refined_by) => {
@@ -1502,7 +1502,8 @@ impl<'genv, 'tcx: 'genv, P: ConvPhase<'genv, 'tcx>> ConvCtxt<P> {
15021502 }
15031503 fhir:: Res :: Def ( DefKind :: TyParam , param_id)
15041504 | fhir:: Res :: SelfTyParam { trait_ : param_id } => {
1505- let predicates = type_param_predicates ( tcx, param_id) ;
1505+ let item_def_id = self . owner ( ) . resolved_id ( ) . unwrap ( ) ;
1506+ let predicates = type_param_predicates ( tcx, item_def_id, param_id) ;
15061507 self . probe_single_bound_for_assoc_item (
15071508 || {
15081509 tag. transitive_bounds_that_define_assoc_item (
@@ -1598,8 +1599,7 @@ impl<'genv, 'tcx: 'genv, P: ConvPhase<'genv, 'tcx>> ConvCtxt<P> {
15981599 fn refiner ( & self ) -> QueryResult < Refiner < ' genv , ' tcx > > {
15991600 match self . owner ( ) {
16001601 FluxOwnerId :: Rust ( owner_id) => {
1601- let def_id = self . genv ( ) . maybe_extern_id ( owner_id. def_id ) ;
1602- Refiner :: default_for_item ( self . genv ( ) , def_id. resolved_id ( ) )
1602+ Refiner :: default_for_item ( self . genv ( ) , owner_id. resolved_id ( ) )
16031603 }
16041604 FluxOwnerId :: Flux ( _) => Err ( query_bug ! ( "cannot refine types insicde flux item" ) ) ,
16051605 }
@@ -2843,19 +2843,14 @@ impl AssocItemTag for AssocReftTag {
28432843/// problem for us so we can use it instead of [`TyCtxt::type_param_predicates`].
28442844fn type_param_predicates < ' tcx > (
28452845 tcx : TyCtxt < ' tcx > ,
2846+ item_def_id : DefId ,
28462847 param_id : DefId ,
28472848) -> impl Iterator < Item = ty:: PolyTraitPredicate < ' tcx > > {
2848- let parent = if tcx. def_kind ( param_id) == DefKind :: Trait {
2849- // If the param_id is a trait then this is the `Self` parameter and the parent is the trait itself
2850- param_id
2851- } else {
2852- tcx. parent ( param_id)
2853- } ;
28542849 let param_index = tcx
2855- . generics_of ( parent )
2850+ . generics_of ( item_def_id )
28562851 . param_def_id_to_index ( tcx, param_id)
28572852 . unwrap ( ) ;
2858- let predicates = tcx. predicates_of ( parent ) . instantiate_identity ( tcx) ;
2853+ let predicates = tcx. predicates_of ( item_def_id ) . instantiate_identity ( tcx) ;
28592854 predicates. into_iter ( ) . filter_map ( move |( clause, _) | {
28602855 clause
28612856 . as_trait_clause ( )
0 commit comments