@@ -531,7 +531,7 @@ fn assemble_candidates_from_param_env<'cx,'tcx>(
531
531
obligation_trait_ref : & ty:: TraitRef < ' tcx > ,
532
532
candidate_set : & mut ProjectionTyCandidateSet < ' tcx > )
533
533
{
534
- let env_predicates = selcx. param_env ( ) . caller_bounds . clone ( ) ;
534
+ let env_predicates = selcx. param_env ( ) . caller_bounds . iter ( ) . cloned ( ) ;
535
535
assemble_candidates_from_predicates ( selcx, obligation, obligation_trait_ref,
536
536
candidate_set, env_predicates) ;
537
537
}
@@ -567,22 +567,25 @@ fn assemble_candidates_from_trait_def<'cx,'tcx>(
567
567
// If so, extract what we know from the trait and try to come up with a good answer.
568
568
let trait_predicates = ty:: lookup_predicates ( selcx. tcx ( ) , trait_ref. def_id ) ;
569
569
let bounds = trait_predicates. instantiate ( selcx. tcx ( ) , trait_ref. substs ) ;
570
+ let bounds = elaborate_predicates ( selcx. tcx ( ) , bounds. predicates . into_vec ( ) ) ;
570
571
assemble_candidates_from_predicates ( selcx, obligation, obligation_trait_ref,
571
- candidate_set, bounds. predicates . into_vec ( ) ) ;
572
+ candidate_set, bounds)
572
573
}
573
574
574
- fn assemble_candidates_from_predicates < ' cx , ' tcx > (
575
+ fn assemble_candidates_from_predicates < ' cx , ' tcx , I > (
575
576
selcx : & mut SelectionContext < ' cx , ' tcx > ,
576
577
obligation : & ProjectionTyObligation < ' tcx > ,
577
578
obligation_trait_ref : & ty:: TraitRef < ' tcx > ,
578
579
candidate_set : & mut ProjectionTyCandidateSet < ' tcx > ,
579
- env_predicates : Vec < ty:: Predicate < ' tcx > > )
580
+ env_predicates : I )
581
+ where I : Iterator < Item =ty:: Predicate < ' tcx > >
580
582
{
581
- debug ! ( "assemble_candidates_from_predicates(obligation={}, env_predicates={})" ,
582
- obligation. repr( selcx. tcx( ) ) ,
583
- env_predicates. repr( selcx. tcx( ) ) ) ;
583
+ debug ! ( "assemble_candidates_from_predicates(obligation={})" ,
584
+ obligation. repr( selcx. tcx( ) ) ) ;
584
585
let infcx = selcx. infcx ( ) ;
585
- for predicate in elaborate_predicates ( selcx. tcx ( ) , env_predicates) {
586
+ for predicate in env_predicates {
587
+ debug ! ( "assemble_candidates_from_predicates: predicate={}" ,
588
+ predicate. repr( selcx. tcx( ) ) ) ;
586
589
match predicate {
587
590
ty:: Predicate :: Projection ( ref data) => {
588
591
let same_name = data. item_name ( ) == obligation. predicate . item_name ;
@@ -637,6 +640,7 @@ fn assemble_candidates_from_object_type<'cx,'tcx>(
637
640
let env_predicates = projection_bounds. iter ( )
638
641
. map ( |p| p. as_predicate ( ) )
639
642
. collect ( ) ;
643
+ let env_predicates = elaborate_predicates ( selcx. tcx ( ) , env_predicates) ;
640
644
assemble_candidates_from_predicates ( selcx, obligation, obligation_trait_ref,
641
645
candidate_set, env_predicates)
642
646
}
0 commit comments