Make prove_predicates take an Iterator
This commit is contained in:
parent
9ec7aa256a
commit
0e2e179571
1 changed files with 16 additions and 9 deletions
|
|
@ -275,7 +275,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> {
|
|||
tcx.predicates_of(def_id).instantiate(tcx, substs);
|
||||
let predicates =
|
||||
type_checker.normalize(&instantiated_predicates.predicates, location);
|
||||
type_checker.prove_predicates(&predicates, location);
|
||||
type_checker.prove_predicates(predicates.iter().cloned(), location);
|
||||
}
|
||||
|
||||
value.ty
|
||||
|
|
@ -1511,28 +1511,35 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
|
|||
|
||||
let predicates = self.normalize(&instantiated_predicates.predicates, location);
|
||||
debug!("prove_aggregate_predicates: predicates={:?}", predicates);
|
||||
self.prove_predicates(&predicates, location);
|
||||
self.prove_predicates(predicates.iter().cloned(), location);
|
||||
}
|
||||
|
||||
fn prove_trait_ref(&mut self, trait_ref: ty::TraitRef<'tcx>, location: Location) {
|
||||
self.prove_predicates(
|
||||
&[ty::Predicate::Trait(
|
||||
[ty::Predicate::Trait(
|
||||
trait_ref.to_poly_trait_ref().to_poly_trait_predicate(),
|
||||
)],
|
||||
)].iter()
|
||||
.cloned(),
|
||||
location,
|
||||
);
|
||||
}
|
||||
|
||||
fn prove_predicates(&mut self, predicates: &[ty::Predicate<'tcx>], location: Location) {
|
||||
fn prove_predicates(
|
||||
&mut self,
|
||||
predicates: impl IntoIterator<Item = ty::Predicate<'tcx>>,
|
||||
location: Location,
|
||||
) {
|
||||
let mut predicates_iter = predicates.into_iter();
|
||||
|
||||
debug!(
|
||||
"prove_predicates(predicates={:?}, location={:?})",
|
||||
predicates, location
|
||||
predicates_iter.by_ref().collect::<Vec<_>>(),
|
||||
location
|
||||
);
|
||||
self.fully_perform_op(location.at_self(), |this| {
|
||||
let cause = this.misc(this.last_span);
|
||||
let obligations = predicates
|
||||
.iter()
|
||||
.map(|&p| traits::Obligation::new(cause.clone(), this.param_env, p))
|
||||
let obligations = predicates_iter
|
||||
.map(|p| traits::Obligation::new(cause.clone(), this.param_env, p))
|
||||
.collect();
|
||||
Ok(InferOk {
|
||||
value: (),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue