@@ -275,7 +275,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> {
275275 tcx. predicates_of ( def_id) . instantiate ( tcx, substs) ;
276276 let predicates =
277277 type_checker. normalize ( & instantiated_predicates. predicates , location) ;
278- type_checker. prove_predicates ( predicates. iter ( ) . cloned ( ) , location) ;
278+ type_checker. prove_predicates ( predicates, location) ;
279279 }
280280
281281 value. ty
@@ -1516,34 +1516,34 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
15161516
15171517 let predicates = self . normalize ( & instantiated_predicates. predicates , location) ;
15181518 debug ! ( "prove_aggregate_predicates: predicates={:?}" , predicates) ;
1519- self . prove_predicates ( predicates. iter ( ) . cloned ( ) , location) ;
1519+ self . prove_predicates ( predicates, location) ;
15201520 }
15211521
15221522 fn prove_trait_ref ( & mut self , trait_ref : ty:: TraitRef < ' tcx > , location : Location ) {
15231523 self . prove_predicates (
1524- [ ty:: Predicate :: Trait (
1524+ Some ( ty:: Predicate :: Trait (
15251525 trait_ref. to_poly_trait_ref ( ) . to_poly_trait_predicate ( ) ,
1526- ) ] . iter ( )
1527- . cloned ( ) ,
1526+ ) ) ,
15281527 location,
15291528 ) ;
15301529 }
15311530
1532- fn prove_predicates (
1533- & mut self ,
1534- predicates : impl IntoIterator < Item = ty:: Predicate < ' tcx > > ,
1535- location : Location ,
1536- ) {
1537- let mut predicates_iter = predicates. into_iter ( ) ;
1531+ fn prove_predicates < T > ( & mut self , predicates : T , location : Location )
1532+ where
1533+ T : IntoIterator < Item = ty:: Predicate < ' tcx > > ,
1534+ T :: IntoIter : Clone ,
1535+ {
1536+ let predicates = predicates. into_iter ( ) ;
15381537
15391538 debug ! (
15401539 "prove_predicates(predicates={:?}, location={:?})" ,
1541- predicates_iter . by_ref ( ) . collect:: <Vec <_>>( ) ,
1542- location
1540+ predicates . clone ( ) . collect:: <Vec <_>>( ) ,
1541+ location,
15431542 ) ;
15441543 self . fully_perform_op ( location. at_self ( ) , |this| {
15451544 let cause = this. misc ( this. last_span ) ;
1546- let obligations = predicates_iter
1545+ let obligations = predicates
1546+ . into_iter ( )
15471547 . map ( |p| traits:: Obligation :: new ( cause. clone ( ) , this. param_env , p) )
15481548 . collect ( ) ;
15491549 Ok ( InferOk {
0 commit comments