@@ -8,7 +8,9 @@ use rustc_type_ir::inherent::*;
8
8
use rustc_type_ir:: lang_items:: TraitSolverLangItem ;
9
9
use rustc_type_ir:: solve:: inspect;
10
10
use rustc_type_ir:: visit:: TypeVisitableExt as _;
11
- use rustc_type_ir:: { self as ty, Interner , TypingMode , Upcast as _, elaborate} ;
11
+ use rustc_type_ir:: {
12
+ self as ty, AliasTy , EarlyBinder , Interner , TypingMode , Upcast as _, elaborate,
13
+ } ;
12
14
use tracing:: { debug, instrument} ;
13
15
14
16
use super :: trait_goals:: TraitGoalProvenVia ;
@@ -594,36 +596,49 @@ where
594
596
}
595
597
} ;
596
598
597
- match consider_self_bounds {
598
- AliasBoundKind :: SelfBounds => {
599
- for assumption in self
600
- . cx ( )
601
- . item_self_bounds ( alias_ty. def_id )
602
- . iter_instantiated ( self . cx ( ) , alias_ty. args )
603
- {
604
- candidates. extend ( G :: probe_and_consider_implied_clause (
605
- self ,
599
+ fn probe_and_consider_implied_clause < ' e , ' d , D , I , G , C , B > (
600
+ ecx : & ' e mut EvalCtxt < ' d , D , I > ,
601
+ alias_ty : AliasTy < I > ,
602
+ bounds : B ,
603
+ goal : Goal < I , G > ,
604
+ ) -> impl Iterator < Item = Candidate < I > > + use < ' e , ' d , D , I , G , C , B >
605
+ where
606
+ D : SolverDelegate < Interner = I > ,
607
+ I : Interner ,
608
+ G : GoalKind < D > ,
609
+ C : IntoIterator < Item = I :: Clause > ,
610
+ B : Fn ( I , I :: DefId ) -> EarlyBinder < I , C > ,
611
+ {
612
+ bounds ( ecx. cx ( ) , alias_ty. def_id ) . iter_instantiated ( ecx. cx ( ) , alias_ty. args ) . filter_map (
613
+ move |assumption| {
614
+ G :: probe_and_consider_implied_clause (
615
+ ecx,
606
616
CandidateSource :: AliasBound ,
607
617
goal,
608
618
assumption,
609
619
[ ] ,
610
- ) ) ;
611
- }
620
+ )
621
+ . ok ( )
622
+ } ,
623
+ )
624
+ }
625
+
626
+ match consider_self_bounds {
627
+ AliasBoundKind :: SelfBounds => {
628
+ candidates. extend ( probe_and_consider_implied_clause (
629
+ self ,
630
+ alias_ty,
631
+ Interner :: item_self_bounds,
632
+ goal,
633
+ ) ) ;
612
634
}
613
635
AliasBoundKind :: NonSelfBounds => {
614
- for assumption in self
615
- . cx ( )
616
- . item_non_self_bounds ( alias_ty. def_id )
617
- . iter_instantiated ( self . cx ( ) , alias_ty. args )
618
- {
619
- candidates. extend ( G :: probe_and_consider_implied_clause (
620
- self ,
621
- CandidateSource :: AliasBound ,
622
- goal,
623
- assumption,
624
- [ ] ,
625
- ) ) ;
626
- }
636
+ candidates. extend ( probe_and_consider_implied_clause (
637
+ self ,
638
+ alias_ty,
639
+ Interner :: item_non_self_bounds,
640
+ goal,
641
+ ) ) ;
627
642
}
628
643
}
629
644
0 commit comments