@@ -580,24 +580,24 @@ pub(super) fn explicit_predicates_of<'tcx>(
580580/// Ensures that the super-predicates of the trait with a `DefId`
581581/// of `trait_def_id` are lowered and stored. This also ensures that
582582/// the transitive super-predicates are lowered.
583- pub ( super ) fn explicit_super_predicates_of (
584- tcx : TyCtxt < ' _ > ,
583+ pub ( super ) fn explicit_super_predicates_of < ' tcx > (
584+ tcx : TyCtxt < ' tcx > ,
585585 trait_def_id : LocalDefId ,
586- ) -> ty:: GenericPredicates < ' _ > {
586+ ) -> ty:: EarlyBinder < ' tcx , & ' tcx [ ( ty :: Clause < ' tcx > , Span ) ] > {
587587 implied_predicates_with_filter ( tcx, trait_def_id. to_def_id ( ) , PredicateFilter :: SelfOnly )
588588}
589589
590- pub ( super ) fn explicit_supertraits_containing_assoc_item (
591- tcx : TyCtxt < ' _ > ,
590+ pub ( super ) fn explicit_supertraits_containing_assoc_item < ' tcx > (
591+ tcx : TyCtxt < ' tcx > ,
592592 ( trait_def_id, assoc_name) : ( DefId , Ident ) ,
593- ) -> ty:: GenericPredicates < ' _ > {
593+ ) -> ty:: EarlyBinder < ' tcx , & ' tcx [ ( ty :: Clause < ' tcx > , Span ) ] > {
594594 implied_predicates_with_filter ( tcx, trait_def_id, PredicateFilter :: SelfThatDefines ( assoc_name) )
595595}
596596
597- pub ( super ) fn explicit_implied_predicates_of (
598- tcx : TyCtxt < ' _ > ,
597+ pub ( super ) fn explicit_implied_predicates_of < ' tcx > (
598+ tcx : TyCtxt < ' tcx > ,
599599 trait_def_id : LocalDefId ,
600- ) -> ty:: GenericPredicates < ' _ > {
600+ ) -> ty:: EarlyBinder < ' tcx , & ' tcx [ ( ty :: Clause < ' tcx > , Span ) ] > {
601601 implied_predicates_with_filter (
602602 tcx,
603603 trait_def_id. to_def_id ( ) ,
@@ -612,11 +612,11 @@ pub(super) fn explicit_implied_predicates_of(
612612/// Ensures that the super-predicates of the trait with a `DefId`
613613/// of `trait_def_id` are lowered and stored. This also ensures that
614614/// the transitive super-predicates are lowered.
615- pub ( super ) fn implied_predicates_with_filter (
616- tcx : TyCtxt < ' _ > ,
615+ pub ( super ) fn implied_predicates_with_filter < ' tcx > (
616+ tcx : TyCtxt < ' tcx > ,
617617 trait_def_id : DefId ,
618618 filter : PredicateFilter ,
619- ) -> ty:: GenericPredicates < ' _ > {
619+ ) -> ty:: EarlyBinder < ' tcx , & ' tcx [ ( ty :: Clause < ' tcx > , Span ) ] > {
620620 let Some ( trait_def_id) = trait_def_id. as_local ( ) else {
621621 // if `assoc_name` is None, then the query should've been redirected to an
622622 // external provider
@@ -679,20 +679,16 @@ pub(super) fn implied_predicates_with_filter(
679679 _ => { }
680680 }
681681
682- ty:: GenericPredicates {
683- parent : None ,
684- predicates : implied_bounds,
685- effects_min_tys : ty:: List :: empty ( ) ,
686- }
682+ ty:: EarlyBinder :: bind ( implied_bounds)
687683}
688684
689685/// Returns the predicates defined on `item_def_id` of the form
690686/// `X: Foo` where `X` is the type parameter `def_id`.
691687#[ instrument( level = "trace" , skip( tcx) ) ]
692- pub ( super ) fn type_param_predicates (
693- tcx : TyCtxt < ' _ > ,
688+ pub ( super ) fn type_param_predicates < ' tcx > (
689+ tcx : TyCtxt < ' tcx > ,
694690 ( item_def_id, def_id, assoc_name) : ( LocalDefId , LocalDefId , Ident ) ,
695- ) -> ty:: GenericPredicates < ' _ > {
691+ ) -> ty:: EarlyBinder < ' tcx , & ' tcx [ ( ty :: Clause < ' tcx > , Span ) ] > {
696692 use rustc_hir:: * ;
697693 use rustc_middle:: ty:: Ty ;
698694
@@ -713,18 +709,20 @@ pub(super) fn type_param_predicates(
713709 tcx. generics_of ( item_def_id) . parent . map ( |def_id| def_id. expect_local ( ) )
714710 } ;
715711
716- let mut result = parent
717- . map ( |parent| {
718- let icx = ItemCtxt :: new ( tcx , parent ) ;
719- icx . probe_ty_param_bounds ( DUMMY_SP , def_id , assoc_name )
720- } )
721- . unwrap_or_default ( ) ;
712+ let result = if let Some ( parent) = parent {
713+ let icx = ItemCtxt :: new ( tcx , parent ) ;
714+ icx. probe_ty_param_bounds ( DUMMY_SP , def_id , assoc_name )
715+ } else {
716+ ty :: EarlyBinder :: bind ( & [ ] as & [ _ ] )
717+ } ;
722718 let mut extend = None ;
723719
724720 let item_hir_id = tcx. local_def_id_to_hir_id ( item_def_id) ;
725721
726722 let hir_node = tcx. hir_node ( item_hir_id) ;
727- let Some ( hir_generics) = hir_node. generics ( ) else { return result } ;
723+ let Some ( hir_generics) = hir_node. generics ( ) else {
724+ return result;
725+ } ;
728726 if let Node :: Item ( item) = hir_node
729727 && let ItemKind :: Trait ( ..) = item. kind
730728 // Implied `Self: Trait` and supertrait bounds.
@@ -748,9 +746,10 @@ pub(super) fn type_param_predicates(
748746 _ => false ,
749747 } ) ,
750748 ) ;
751- result. predicates =
752- tcx. arena . alloc_from_iter ( result. predicates . iter ( ) . copied ( ) . chain ( extra_predicates) ) ;
753- result
749+
750+ ty:: EarlyBinder :: bind (
751+ tcx. arena . alloc_from_iter ( result. skip_binder ( ) . iter ( ) . copied ( ) . chain ( extra_predicates) ) ,
752+ )
754753}
755754
756755impl < ' tcx > ItemCtxt < ' tcx > {
0 commit comments