@@ -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, location) ;
278
+ type_checker. prove_predicates ( predicates. iter ( ) . cloned ( ) , location) ;
279
279
}
280
280
281
281
value. ty
@@ -1511,28 +1511,35 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
1511
1511
1512
1512
let predicates = self . normalize ( & instantiated_predicates. predicates , location) ;
1513
1513
debug ! ( "prove_aggregate_predicates: predicates={:?}" , predicates) ;
1514
- self . prove_predicates ( & predicates, location) ;
1514
+ self . prove_predicates ( predicates. iter ( ) . cloned ( ) , location) ;
1515
1515
}
1516
1516
1517
1517
fn prove_trait_ref ( & mut self , trait_ref : ty:: TraitRef < ' tcx > , location : Location ) {
1518
1518
self . prove_predicates (
1519
- & [ ty:: Predicate :: Trait (
1519
+ [ ty:: Predicate :: Trait (
1520
1520
trait_ref. to_poly_trait_ref ( ) . to_poly_trait_predicate ( ) ,
1521
- ) ] ,
1521
+ ) ] . iter ( )
1522
+ . cloned ( ) ,
1522
1523
location,
1523
1524
) ;
1524
1525
}
1525
1526
1526
- fn prove_predicates ( & mut self , predicates : & [ ty:: Predicate < ' tcx > ] , location : Location ) {
1527
+ fn prove_predicates (
1528
+ & mut self ,
1529
+ predicates : impl IntoIterator < Item = ty:: Predicate < ' tcx > > ,
1530
+ location : Location ,
1531
+ ) {
1532
+ let mut predicates_iter = predicates. into_iter ( ) ;
1533
+
1527
1534
debug ! (
1528
1535
"prove_predicates(predicates={:?}, location={:?})" ,
1529
- predicates, location
1536
+ predicates_iter. by_ref( ) . collect:: <Vec <_>>( ) ,
1537
+ location
1530
1538
) ;
1531
1539
self . fully_perform_op ( location. at_self ( ) , |this| {
1532
1540
let cause = this. misc ( this. last_span ) ;
1533
- let obligations = predicates
1534
- . iter ( )
1535
- . map ( |& p| traits:: Obligation :: new ( cause. clone ( ) , this. param_env , p) )
1541
+ let obligations = predicates_iter
1542
+ . map ( |p| traits:: Obligation :: new ( cause. clone ( ) , this. param_env , p) )
1536
1543
. collect ( ) ;
1537
1544
Ok ( InferOk {
1538
1545
value : ( ) ,
0 commit comments