@@ -31,6 +31,7 @@ use rustc::middle::stability;
3131use syntax:: ast;
3232use syntax:: util:: lev_distance:: { lev_distance, find_best_match_for_name} ;
3333use syntax_pos:: { Span , symbol:: Symbol } ;
34+ use std:: iter;
3435use std:: mem;
3536use std:: ops:: Deref ;
3637use std:: rc:: Rc ;
@@ -627,7 +628,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
627628 // itself. Hence, a `&self` method will wind up with an
628629 // argument type like `&Trait`.
629630 let trait_ref = principal. with_self_ty ( self . tcx , self_ty) ;
630- self . elaborate_bounds ( & [ trait_ref] , |this, new_trait_ref, item| {
631+ self . elaborate_bounds ( iter :: once ( trait_ref) , |this, new_trait_ref, item| {
631632 let new_trait_ref = this. erase_late_bound_regions ( & new_trait_ref) ;
632633
633634 let ( xform_self_ty, xform_ret_ty) =
@@ -645,7 +646,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
645646 param_ty : ty:: ParamTy ) {
646647 // FIXME -- Do we want to commit to this behavior for param bounds?
647648
648- let bounds: Vec < _ > = self . param_env
649+ let bounds = self . param_env
649650 . caller_bounds
650651 . iter ( )
651652 . filter_map ( |predicate| {
@@ -667,10 +668,9 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
667668 ty:: Predicate :: TypeOutlives ( ..) |
668669 ty:: Predicate :: ConstEvaluatable ( ..) => None ,
669670 }
670- } )
671- . collect ( ) ;
671+ } ) ;
672672
673- self . elaborate_bounds ( & bounds, |this, poly_trait_ref, item| {
673+ self . elaborate_bounds ( bounds, |this, poly_trait_ref, item| {
674674 let trait_ref = this. erase_late_bound_regions ( & poly_trait_ref) ;
675675
676676 let ( xform_self_ty, xform_ret_ty) =
@@ -693,15 +693,16 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
693693
694694 // Do a search through a list of bounds, using a callback to actually
695695 // create the candidates.
696- fn elaborate_bounds < F > ( & mut self , bounds : & [ ty:: PolyTraitRef < ' tcx > ] , mut mk_cand : F )
696+ fn elaborate_bounds < F > ( & mut self ,
697+ bounds : impl Iterator < Item = ty:: PolyTraitRef < ' tcx > > ,
698+ mut mk_cand : F )
697699 where F : for < ' b > FnMut ( & mut ProbeContext < ' b , ' gcx , ' tcx > ,
698700 ty:: PolyTraitRef < ' tcx > ,
699701 ty:: AssociatedItem )
700702 {
701- debug ! ( "elaborate_bounds(bounds={:?})" , bounds) ;
702-
703703 let tcx = self . tcx ;
704704 for bound_trait_ref in traits:: transitive_bounds ( tcx, bounds) {
705+ debug ! ( "elaborate_bounds(bound_trait_ref={:?})" , bound_trait_ref) ;
705706 for item in self . impl_or_trait_item ( bound_trait_ref. def_id ( ) ) {
706707 if !self . has_applicable_self ( & item) {
707708 self . record_static_candidate ( TraitSource ( bound_trait_ref. def_id ( ) ) ) ;
0 commit comments