mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 11:07:42 +00:00
Rollup merge of #56742 - ljedrz:remove_query_response_box, r=oli-obk
infer: remove Box from a returned Iterator
This commit is contained in:
commit
af3f9072f5
@ -36,6 +36,7 @@ use traits::{Obligation, ObligationCause, PredicateObligation};
|
|||||||
use ty::fold::TypeFoldable;
|
use ty::fold::TypeFoldable;
|
||||||
use ty::subst::{Kind, UnpackedKind};
|
use ty::subst::{Kind, UnpackedKind};
|
||||||
use ty::{self, BoundVar, Lift, Ty, TyCtxt};
|
use ty::{self, BoundVar, Lift, Ty, TyCtxt};
|
||||||
|
use util::captures::Captures;
|
||||||
|
|
||||||
impl<'cx, 'gcx, 'tcx> InferCtxtBuilder<'cx, 'gcx, 'tcx> {
|
impl<'cx, 'gcx, 'tcx> InferCtxtBuilder<'cx, 'gcx, 'tcx> {
|
||||||
/// The "main method" for a canonicalized trait query. Given the
|
/// The "main method" for a canonicalized trait query. Given the
|
||||||
@ -527,32 +528,30 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
|
|||||||
param_env: ty::ParamEnv<'tcx>,
|
param_env: ty::ParamEnv<'tcx>,
|
||||||
unsubstituted_region_constraints: &'a [QueryRegionConstraint<'tcx>],
|
unsubstituted_region_constraints: &'a [QueryRegionConstraint<'tcx>],
|
||||||
result_subst: &'a CanonicalVarValues<'tcx>,
|
result_subst: &'a CanonicalVarValues<'tcx>,
|
||||||
) -> impl Iterator<Item = PredicateObligation<'tcx>> + 'a {
|
) -> impl Iterator<Item = PredicateObligation<'tcx>> + 'a + Captures<'gcx> {
|
||||||
Box::new(
|
unsubstituted_region_constraints
|
||||||
unsubstituted_region_constraints
|
.iter()
|
||||||
.iter()
|
.map(move |constraint| {
|
||||||
.map(move |constraint| {
|
let constraint = substitute_value(self.tcx, result_subst, constraint);
|
||||||
let constraint = substitute_value(self.tcx, result_subst, constraint);
|
let &ty::OutlivesPredicate(k1, r2) = constraint.skip_binder(); // restored below
|
||||||
let &ty::OutlivesPredicate(k1, r2) = constraint.skip_binder(); // restored below
|
|
||||||
|
|
||||||
Obligation::new(
|
Obligation::new(
|
||||||
cause.clone(),
|
cause.clone(),
|
||||||
param_env,
|
param_env,
|
||||||
match k1.unpack() {
|
match k1.unpack() {
|
||||||
UnpackedKind::Lifetime(r1) => ty::Predicate::RegionOutlives(
|
UnpackedKind::Lifetime(r1) => ty::Predicate::RegionOutlives(
|
||||||
ty::Binder::bind(
|
ty::Binder::bind(
|
||||||
ty::OutlivesPredicate(r1, r2)
|
ty::OutlivesPredicate(r1, r2)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
UnpackedKind::Type(t1) => ty::Predicate::TypeOutlives(
|
UnpackedKind::Type(t1) => ty::Predicate::TypeOutlives(
|
||||||
ty::Binder::bind(
|
ty::Binder::bind(
|
||||||
ty::OutlivesPredicate(t1, r2)
|
ty::OutlivesPredicate(t1, r2)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
) as Box<dyn Iterator<Item = _>>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Given two sets of values for the same set of canonical variables, unify them.
|
/// Given two sets of values for the same set of canonical variables, unify them.
|
||||||
|
Loading…
Reference in New Issue
Block a user