@@ -275,7 +275,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> {
275
275
tcx. predicates_of ( def_id) . instantiate ( tcx, substs) ;
276
276
let predicates =
277
277
type_checker. normalize ( & instantiated_predicates. predicates , location) ;
278
- type_checker. prove_predicates ( predicates. iter ( ) . cloned ( ) , location) ;
278
+ type_checker. prove_predicates ( predicates, location) ;
279
279
}
280
280
281
281
value. ty
@@ -1516,34 +1516,34 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
1516
1516
1517
1517
let predicates = self . normalize ( & instantiated_predicates. predicates , location) ;
1518
1518
debug ! ( "prove_aggregate_predicates: predicates={:?}" , predicates) ;
1519
- self . prove_predicates ( predicates. iter ( ) . cloned ( ) , location) ;
1519
+ self . prove_predicates ( predicates, location) ;
1520
1520
}
1521
1521
1522
1522
fn prove_trait_ref ( & mut self , trait_ref : ty:: TraitRef < ' tcx > , location : Location ) {
1523
1523
self . prove_predicates (
1524
- [ ty:: Predicate :: Trait (
1524
+ Some ( ty:: Predicate :: Trait (
1525
1525
trait_ref. to_poly_trait_ref ( ) . to_poly_trait_predicate ( ) ,
1526
- ) ] . iter ( )
1527
- . cloned ( ) ,
1526
+ ) ) ,
1528
1527
location,
1529
1528
) ;
1530
1529
}
1531
1530
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 ( ) ;
1538
1537
1539
1538
debug ! (
1540
1539
"prove_predicates(predicates={:?}, location={:?})" ,
1541
- predicates_iter . by_ref ( ) . collect:: <Vec <_>>( ) ,
1542
- location
1540
+ predicates . clone ( ) . collect:: <Vec <_>>( ) ,
1541
+ location,
1543
1542
) ;
1544
1543
self . fully_perform_op ( location. at_self ( ) , |this| {
1545
1544
let cause = this. misc ( this. last_span ) ;
1546
- let obligations = predicates_iter
1545
+ let obligations = predicates
1546
+ . into_iter ( )
1547
1547
. map ( |p| traits:: Obligation :: new ( cause. clone ( ) , this. param_env , p) )
1548
1548
. collect ( ) ;
1549
1549
Ok ( InferOk {
0 commit comments