Rename arg_iter to iter_instantiated
This commit is contained in:
parent
4eaad89dce
commit
05f6890b3e
20 changed files with 47 additions and 40 deletions
|
@ -695,7 +695,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
.find_map(find_fn_kind_from_did),
|
.find_map(find_fn_kind_from_did),
|
||||||
ty::Alias(ty::Opaque, ty::AliasTy { def_id, args, .. }) => tcx
|
ty::Alias(ty::Opaque, ty::AliasTy { def_id, args, .. }) => tcx
|
||||||
.explicit_item_bounds(def_id)
|
.explicit_item_bounds(def_id)
|
||||||
.arg_iter_copied(tcx, args)
|
.iter_instantiated_copied(tcx, args)
|
||||||
.find_map(|(clause, span)| find_fn_kind_from_did((clause, span))),
|
.find_map(|(clause, span)| find_fn_kind_from_did((clause, span))),
|
||||||
ty::Closure(_, args) => match args.as_closure().kind() {
|
ty::Closure(_, args) => match args.as_closure().kind() {
|
||||||
ty::ClosureKind::Fn => Some(hir::Mutability::Not),
|
ty::ClosureKind::Fn => Some(hir::Mutability::Not),
|
||||||
|
|
|
@ -867,7 +867,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for ImplTraitInTraitCollector<'_, 'tcx> {
|
||||||
});
|
});
|
||||||
self.types.insert(proj.def_id, (infer_ty, proj.args));
|
self.types.insert(proj.def_id, (infer_ty, proj.args));
|
||||||
// Recurse into bounds
|
// Recurse into bounds
|
||||||
for (pred, pred_span) in self.interner().explicit_item_bounds(proj.def_id).arg_iter_copied(self.interner(), proj.args) {
|
for (pred, pred_span) in self.interner().explicit_item_bounds(proj.def_id).iter_instantiated_copied(self.interner(), proj.args) {
|
||||||
let pred = pred.fold_with(self);
|
let pred = pred.fold_with(self);
|
||||||
let pred = self.ocx.normalize(
|
let pred = self.ocx.normalize(
|
||||||
&ObligationCause::misc(self.span, self.body_id),
|
&ObligationCause::misc(self.span, self.body_id),
|
||||||
|
@ -2149,7 +2149,7 @@ pub(super) fn check_type_bounds<'tcx>(
|
||||||
|
|
||||||
let obligations: Vec<_> = tcx
|
let obligations: Vec<_> = tcx
|
||||||
.explicit_item_bounds(trait_ty.def_id)
|
.explicit_item_bounds(trait_ty.def_id)
|
||||||
.arg_iter_copied(tcx, rebased_args)
|
.iter_instantiated_copied(tcx, rebased_args)
|
||||||
.map(|(concrete_ty_bound, span)| {
|
.map(|(concrete_ty_bound, span)| {
|
||||||
debug!("check_type_bounds: concrete_ty_bound = {:?}", concrete_ty_bound);
|
debug!("check_type_bounds: concrete_ty_bound = {:?}", concrete_ty_bound);
|
||||||
traits::Obligation::new(tcx, mk_cause(span), param_env, concrete_ty_bound)
|
traits::Obligation::new(tcx, mk_cause(span), param_env, concrete_ty_bound)
|
||||||
|
|
|
@ -409,7 +409,7 @@ fn fn_sig_suggestion<'tcx>(
|
||||||
let asyncness = if tcx.asyncness(assoc.def_id).is_async() {
|
let asyncness = if tcx.asyncness(assoc.def_id).is_async() {
|
||||||
output = if let ty::Alias(_, alias_ty) = *output.kind() {
|
output = if let ty::Alias(_, alias_ty) = *output.kind() {
|
||||||
tcx.explicit_item_bounds(alias_ty.def_id)
|
tcx.explicit_item_bounds(alias_ty.def_id)
|
||||||
.arg_iter_copied(tcx, alias_ty.args)
|
.iter_instantiated_copied(tcx, alias_ty.args)
|
||||||
.find_map(|(bound, _)| bound.as_projection_clause()?.no_bound_vars()?.term.ty())
|
.find_map(|(bound, _)| bound.as_projection_clause()?.no_bound_vars()?.term.ty())
|
||||||
.unwrap_or_else(|| {
|
.unwrap_or_else(|| {
|
||||||
span_bug!(
|
span_bug!(
|
||||||
|
|
|
@ -1567,7 +1567,7 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for ImplTraitInTraitFinder<'_, 'tcx> {
|
||||||
});
|
});
|
||||||
for (bound, bound_span) in tcx
|
for (bound, bound_span) in tcx
|
||||||
.explicit_item_bounds(opaque_ty.def_id)
|
.explicit_item_bounds(opaque_ty.def_id)
|
||||||
.arg_iter_copied(tcx, opaque_ty.args)
|
.iter_instantiated_copied(tcx, opaque_ty.args)
|
||||||
{
|
{
|
||||||
let bound = self.wfcx.normalize(bound_span, None, bound);
|
let bound = self.wfcx.normalize(bound_span, None, bound);
|
||||||
self.wfcx.register_obligations(traits::wf::predicate_obligations(
|
self.wfcx.register_obligations(traits::wf::predicate_obligations(
|
||||||
|
|
|
@ -145,7 +145,7 @@ fn variance_of_opaque(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[ty::Varianc
|
||||||
let mut collector =
|
let mut collector =
|
||||||
OpaqueTypeLifetimeCollector { tcx, root_def_id: item_def_id.to_def_id(), variances };
|
OpaqueTypeLifetimeCollector { tcx, root_def_id: item_def_id.to_def_id(), variances };
|
||||||
let id_args = ty::GenericArgs::identity_for_item(tcx, item_def_id);
|
let id_args = ty::GenericArgs::identity_for_item(tcx, item_def_id);
|
||||||
for (pred, _) in tcx.explicit_item_bounds(item_def_id).arg_iter_copied(tcx, id_args) {
|
for (pred, _) in tcx.explicit_item_bounds(item_def_id).iter_instantiated_copied(tcx, id_args) {
|
||||||
debug!(?pred);
|
debug!(?pred);
|
||||||
|
|
||||||
// We only ignore opaque type args if the opaque type is the outermost type.
|
// We only ignore opaque type args if the opaque type is the outermost type.
|
||||||
|
|
|
@ -551,8 +551,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
for ty in [first_ty, second_ty] {
|
for ty in [first_ty, second_ty] {
|
||||||
for (clause, _) in
|
for (clause, _) in self
|
||||||
self.tcx.explicit_item_bounds(rpit_def_id).arg_iter_copied(self.tcx, args)
|
.tcx
|
||||||
|
.explicit_item_bounds(rpit_def_id)
|
||||||
|
.iter_instantiated_copied(self.tcx, args)
|
||||||
{
|
{
|
||||||
let pred = clause.kind().rebind(match clause.kind().skip_binder() {
|
let pred = clause.kind().rebind(match clause.kind().skip_binder() {
|
||||||
ty::ClauseKind::Trait(trait_pred) => {
|
ty::ClauseKind::Trait(trait_pred) => {
|
||||||
|
|
|
@ -177,7 +177,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
expected_ty,
|
expected_ty,
|
||||||
self.tcx
|
self.tcx
|
||||||
.explicit_item_bounds(def_id)
|
.explicit_item_bounds(def_id)
|
||||||
.arg_iter_copied(self.tcx, args)
|
.iter_instantiated_copied(self.tcx, args)
|
||||||
.map(|(c, s)| (c.as_predicate(), s)),
|
.map(|(c, s)| (c.as_predicate(), s)),
|
||||||
),
|
),
|
||||||
ty::Dynamic(ref object_type, ..) => {
|
ty::Dynamic(ref object_type, ..) => {
|
||||||
|
@ -720,13 +720,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
ty::Alias(ty::Opaque, ty::AliasTy { def_id, args, .. }) => self
|
ty::Alias(ty::Opaque, ty::AliasTy { def_id, args, .. }) => self
|
||||||
.tcx
|
.tcx
|
||||||
.explicit_item_bounds(def_id)
|
.explicit_item_bounds(def_id)
|
||||||
.arg_iter_copied(self.tcx, args)
|
.iter_instantiated_copied(self.tcx, args)
|
||||||
.find_map(|(p, s)| get_future_output(p.as_predicate(), s))?,
|
.find_map(|(p, s)| get_future_output(p.as_predicate(), s))?,
|
||||||
ty::Error(_) => return None,
|
ty::Error(_) => return None,
|
||||||
ty::Alias(ty::Projection, proj) if self.tcx.is_impl_trait_in_trait(proj.def_id) => self
|
ty::Alias(ty::Projection, proj) if self.tcx.is_impl_trait_in_trait(proj.def_id) => self
|
||||||
.tcx
|
.tcx
|
||||||
.explicit_item_bounds(proj.def_id)
|
.explicit_item_bounds(proj.def_id)
|
||||||
.arg_iter_copied(self.tcx, proj.args)
|
.iter_instantiated_copied(self.tcx, proj.args)
|
||||||
.find_map(|(p, s)| get_future_output(p.as_predicate(), s))?,
|
.find_map(|(p, s)| get_future_output(p.as_predicate(), s))?,
|
||||||
_ => span_bug!(
|
_ => span_bug!(
|
||||||
self.tcx.def_span(expr_def_id),
|
self.tcx.def_span(expr_def_id),
|
||||||
|
|
|
@ -403,7 +403,7 @@ impl<'tcx> InferCtxt<'tcx> {
|
||||||
let future_trait = self.tcx.require_lang_item(LangItem::Future, None);
|
let future_trait = self.tcx.require_lang_item(LangItem::Future, None);
|
||||||
let item_def_id = self.tcx.associated_item_def_ids(future_trait)[0];
|
let item_def_id = self.tcx.associated_item_def_ids(future_trait)[0];
|
||||||
|
|
||||||
self.tcx.explicit_item_bounds(def_id).arg_iter_copied(self.tcx, args).find_map(
|
self.tcx.explicit_item_bounds(def_id).iter_instantiated_copied(self.tcx, args).find_map(
|
||||||
|(predicate, _)| {
|
|(predicate, _)| {
|
||||||
predicate
|
predicate
|
||||||
.kind()
|
.kind()
|
||||||
|
|
|
@ -591,7 +591,7 @@ impl<'tcx> InferCtxt<'tcx> {
|
||||||
let tcx = self.tcx;
|
let tcx = self.tcx;
|
||||||
let item_bounds = tcx.explicit_item_bounds(def_id);
|
let item_bounds = tcx.explicit_item_bounds(def_id);
|
||||||
|
|
||||||
for (predicate, _) in item_bounds.arg_iter_copied(tcx, args) {
|
for (predicate, _) in item_bounds.iter_instantiated_copied(tcx, args) {
|
||||||
let predicate = predicate.fold_with(&mut BottomUpFolder {
|
let predicate = predicate.fold_with(&mut BottomUpFolder {
|
||||||
tcx,
|
tcx,
|
||||||
ty_op: |ty| match *ty.kind() {
|
ty_op: |ty| match *ty.kind() {
|
||||||
|
|
|
@ -295,7 +295,7 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
|
||||||
let bounds = tcx.item_bounds(alias_ty.def_id);
|
let bounds = tcx.item_bounds(alias_ty.def_id);
|
||||||
trace!("{:#?}", bounds.skip_binder());
|
trace!("{:#?}", bounds.skip_binder());
|
||||||
bounds
|
bounds
|
||||||
.arg_iter(tcx, alias_ty.args)
|
.iter_instantiated(tcx, alias_ty.args)
|
||||||
.filter_map(|p| p.as_type_outlives_clause())
|
.filter_map(|p| p.as_type_outlives_clause())
|
||||||
.filter_map(|p| p.no_bound_vars())
|
.filter_map(|p| p.no_bound_vars())
|
||||||
.map(|OutlivesPredicate(_, r)| r)
|
.map(|OutlivesPredicate(_, r)| r)
|
||||||
|
|
|
@ -117,7 +117,7 @@ impl<'tcx> LateLintPass<'tcx> for OpaqueHiddenInferredBound {
|
||||||
for (assoc_pred, assoc_pred_span) in cx
|
for (assoc_pred, assoc_pred_span) in cx
|
||||||
.tcx
|
.tcx
|
||||||
.explicit_item_bounds(proj.projection_ty.def_id)
|
.explicit_item_bounds(proj.projection_ty.def_id)
|
||||||
.arg_iter_copied(cx.tcx, &proj.projection_ty.args)
|
.iter_instantiated_copied(cx.tcx, &proj.projection_ty.args)
|
||||||
{
|
{
|
||||||
let assoc_pred = assoc_pred.fold_with(proj_replacer);
|
let assoc_pred = assoc_pred.fold_with(proj_replacer);
|
||||||
let Ok(assoc_pred) = traits::fully_normalize(
|
let Ok(assoc_pred) = traits::fully_normalize(
|
||||||
|
|
|
@ -610,8 +610,12 @@ impl<'tcx, 's, I: IntoIterator> EarlyBinder<I>
|
||||||
where
|
where
|
||||||
I::Item: TypeFoldable<TyCtxt<'tcx>>,
|
I::Item: TypeFoldable<TyCtxt<'tcx>>,
|
||||||
{
|
{
|
||||||
pub fn arg_iter(self, tcx: TyCtxt<'tcx>, args: &'s [GenericArg<'tcx>]) -> ArgIter<'s, 'tcx, I> {
|
pub fn iter_instantiated(
|
||||||
ArgIter { it: self.value.into_iter(), tcx, args }
|
self,
|
||||||
|
tcx: TyCtxt<'tcx>,
|
||||||
|
args: &'s [GenericArg<'tcx>],
|
||||||
|
) -> IterInstantiated<'s, 'tcx, I> {
|
||||||
|
IterInstantiated { it: self.value.into_iter(), tcx, args }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Similar to [`instantiate_identity`](EarlyBinder::instantiate_identity),
|
/// Similar to [`instantiate_identity`](EarlyBinder::instantiate_identity),
|
||||||
|
@ -621,13 +625,13 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ArgIter<'s, 'tcx, I: IntoIterator> {
|
pub struct IterInstantiated<'s, 'tcx, I: IntoIterator> {
|
||||||
it: I::IntoIter,
|
it: I::IntoIter,
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
args: &'s [GenericArg<'tcx>],
|
args: &'s [GenericArg<'tcx>],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, I: IntoIterator> Iterator for ArgIter<'_, 'tcx, I>
|
impl<'tcx, I: IntoIterator> Iterator for IterInstantiated<'_, 'tcx, I>
|
||||||
where
|
where
|
||||||
I::Item: TypeFoldable<TyCtxt<'tcx>>,
|
I::Item: TypeFoldable<TyCtxt<'tcx>>,
|
||||||
{
|
{
|
||||||
|
@ -642,7 +646,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, I: IntoIterator> DoubleEndedIterator for ArgIter<'_, 'tcx, I>
|
impl<'tcx, I: IntoIterator> DoubleEndedIterator for IterInstantiated<'_, 'tcx, I>
|
||||||
where
|
where
|
||||||
I::IntoIter: DoubleEndedIterator,
|
I::IntoIter: DoubleEndedIterator,
|
||||||
I::Item: TypeFoldable<TyCtxt<'tcx>>,
|
I::Item: TypeFoldable<TyCtxt<'tcx>>,
|
||||||
|
@ -652,7 +656,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, I: IntoIterator> ExactSizeIterator for ArgIter<'_, 'tcx, I>
|
impl<'tcx, I: IntoIterator> ExactSizeIterator for IterInstantiated<'_, 'tcx, I>
|
||||||
where
|
where
|
||||||
I::IntoIter: ExactSizeIterator,
|
I::IntoIter: ExactSizeIterator,
|
||||||
I::Item: TypeFoldable<TyCtxt<'tcx>>,
|
I::Item: TypeFoldable<TyCtxt<'tcx>>,
|
||||||
|
@ -664,12 +668,12 @@ where
|
||||||
I::Item: Deref,
|
I::Item: Deref,
|
||||||
<I::Item as Deref>::Target: Copy + TypeFoldable<TyCtxt<'tcx>>,
|
<I::Item as Deref>::Target: Copy + TypeFoldable<TyCtxt<'tcx>>,
|
||||||
{
|
{
|
||||||
pub fn arg_iter_copied(
|
pub fn iter_instantiated_copied(
|
||||||
self,
|
self,
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
args: &'s [GenericArg<'tcx>],
|
args: &'s [GenericArg<'tcx>],
|
||||||
) -> ArgIterCopied<'s, 'tcx, I> {
|
) -> IterInstantiatedCopied<'s, 'tcx, I> {
|
||||||
ArgIterCopied { it: self.value.into_iter(), tcx, args }
|
IterInstantiatedCopied { it: self.value.into_iter(), tcx, args }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Similar to [`instantiate_identity`](EarlyBinder::instantiate_identity),
|
/// Similar to [`instantiate_identity`](EarlyBinder::instantiate_identity),
|
||||||
|
@ -681,13 +685,13 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ArgIterCopied<'a, 'tcx, I: IntoIterator> {
|
pub struct IterInstantiatedCopied<'a, 'tcx, I: IntoIterator> {
|
||||||
it: I::IntoIter,
|
it: I::IntoIter,
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
args: &'a [GenericArg<'tcx>],
|
args: &'a [GenericArg<'tcx>],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, I: IntoIterator> Iterator for ArgIterCopied<'_, 'tcx, I>
|
impl<'tcx, I: IntoIterator> Iterator for IterInstantiatedCopied<'_, 'tcx, I>
|
||||||
where
|
where
|
||||||
I::Item: Deref,
|
I::Item: Deref,
|
||||||
<I::Item as Deref>::Target: Copy + TypeFoldable<TyCtxt<'tcx>>,
|
<I::Item as Deref>::Target: Copy + TypeFoldable<TyCtxt<'tcx>>,
|
||||||
|
@ -703,7 +707,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, I: IntoIterator> DoubleEndedIterator for ArgIterCopied<'_, 'tcx, I>
|
impl<'tcx, I: IntoIterator> DoubleEndedIterator for IterInstantiatedCopied<'_, 'tcx, I>
|
||||||
where
|
where
|
||||||
I::IntoIter: DoubleEndedIterator,
|
I::IntoIter: DoubleEndedIterator,
|
||||||
I::Item: Deref,
|
I::Item: Deref,
|
||||||
|
@ -716,7 +720,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, I: IntoIterator> ExactSizeIterator for ArgIterCopied<'_, 'tcx, I>
|
impl<'tcx, I: IntoIterator> ExactSizeIterator for IterInstantiatedCopied<'_, 'tcx, I>
|
||||||
where
|
where
|
||||||
I::IntoIter: ExactSizeIterator,
|
I::IntoIter: ExactSizeIterator,
|
||||||
I::Item: Deref,
|
I::Item: Deref,
|
||||||
|
|
|
@ -347,7 +347,7 @@ impl<'tcx> GenericPredicates<'tcx> {
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
args: GenericArgsRef<'tcx>,
|
args: GenericArgsRef<'tcx>,
|
||||||
) -> impl Iterator<Item = (Clause<'tcx>, Span)> + DoubleEndedIterator + ExactSizeIterator {
|
) -> impl Iterator<Item = (Clause<'tcx>, Span)> + DoubleEndedIterator + ExactSizeIterator {
|
||||||
EarlyBinder::bind(self.predicates).arg_iter_copied(tcx, args)
|
EarlyBinder::bind(self.predicates).iter_instantiated_copied(tcx, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(level = "debug", skip(self, tcx))]
|
#[instrument(level = "debug", skip(self, tcx))]
|
||||||
|
|
|
@ -928,7 +928,7 @@ pub trait PrettyPrinter<'tcx>:
|
||||||
let mut is_sized = false;
|
let mut is_sized = false;
|
||||||
let mut lifetimes = SmallVec::<[ty::Region<'tcx>; 1]>::new();
|
let mut lifetimes = SmallVec::<[ty::Region<'tcx>; 1]>::new();
|
||||||
|
|
||||||
for (predicate, _) in bounds.arg_iter_copied(tcx, args) {
|
for (predicate, _) in bounds.iter_instantiated_copied(tcx, args) {
|
||||||
let bound_predicate = predicate.kind();
|
let bound_predicate = predicate.kind();
|
||||||
|
|
||||||
match bound_predicate.skip_binder() {
|
match bound_predicate.skip_binder() {
|
||||||
|
|
|
@ -148,7 +148,7 @@ pub(in crate::solve) fn instantiate_constituent_tys_for_sized_trait<'tcx>(
|
||||||
|
|
||||||
ty::Adt(def, args) => {
|
ty::Adt(def, args) => {
|
||||||
let sized_crit = def.sized_constraint(ecx.tcx());
|
let sized_crit = def.sized_constraint(ecx.tcx());
|
||||||
Ok(sized_crit.arg_iter_copied(ecx.tcx(), args).collect())
|
Ok(sized_crit.iter_instantiated_copied(ecx.tcx(), args).collect())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -353,7 +353,8 @@ pub(in crate::solve) fn predicates_for_object_candidate<'tcx>(
|
||||||
// FIXME(associated_const_equality): Also add associated consts to
|
// FIXME(associated_const_equality): Also add associated consts to
|
||||||
// the requirements here.
|
// the requirements here.
|
||||||
if item.kind == ty::AssocKind::Type {
|
if item.kind == ty::AssocKind::Type {
|
||||||
requirements.extend(tcx.item_bounds(item.def_id).arg_iter(tcx, trait_ref.args));
|
requirements
|
||||||
|
.extend(tcx.item_bounds(item.def_id).iter_instantiated(tcx, trait_ref.args));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2133,7 +2133,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
|
||||||
Where(
|
Where(
|
||||||
obligation
|
obligation
|
||||||
.predicate
|
.predicate
|
||||||
.rebind(sized_crit.arg_iter_copied(self.tcx(), args).collect()),
|
.rebind(sized_crit.iter_instantiated_copied(self.tcx(), args).collect()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ fn sized_constraint_for_ty<'tcx>(
|
||||||
let adt_tys = adt.sized_constraint(tcx);
|
let adt_tys = adt.sized_constraint(tcx);
|
||||||
debug!("sized_constraint_for_ty({:?}) intermediate = {:?}", ty, adt_tys);
|
debug!("sized_constraint_for_ty({:?}) intermediate = {:?}", ty, adt_tys);
|
||||||
adt_tys
|
adt_tys
|
||||||
.arg_iter_copied(tcx, args)
|
.iter_instantiated_copied(tcx, args)
|
||||||
.flat_map(|ty| sized_constraint_for_ty(tcx, adtdef, ty))
|
.flat_map(|ty| sized_constraint_for_ty(tcx, adtdef, ty))
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
@ -297,7 +297,7 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for ImplTraitInTraitFinder<'_, 'tcx> {
|
||||||
for bound in self
|
for bound in self
|
||||||
.tcx
|
.tcx
|
||||||
.item_bounds(unshifted_alias_ty.def_id)
|
.item_bounds(unshifted_alias_ty.def_id)
|
||||||
.arg_iter(self.tcx, unshifted_alias_ty.args)
|
.iter_instantiated(self.tcx, unshifted_alias_ty.args)
|
||||||
{
|
{
|
||||||
bound.visit_with(self);
|
bound.visit_with(self);
|
||||||
}
|
}
|
||||||
|
|
|
@ -441,7 +441,7 @@ fn clean_projection<'tcx>(
|
||||||
let bounds = cx
|
let bounds = cx
|
||||||
.tcx
|
.tcx
|
||||||
.explicit_item_bounds(ty.skip_binder().def_id)
|
.explicit_item_bounds(ty.skip_binder().def_id)
|
||||||
.arg_iter_copied(cx.tcx, ty.skip_binder().args)
|
.iter_instantiated_copied(cx.tcx, ty.skip_binder().args)
|
||||||
.map(|(pred, _)| pred)
|
.map(|(pred, _)| pred)
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
return clean_middle_opaque_bounds(cx, bounds);
|
return clean_middle_opaque_bounds(cx, bounds);
|
||||||
|
@ -2071,7 +2071,7 @@ pub(crate) fn clean_middle_ty<'tcx>(
|
||||||
let bounds = cx
|
let bounds = cx
|
||||||
.tcx
|
.tcx
|
||||||
.explicit_item_bounds(def_id)
|
.explicit_item_bounds(def_id)
|
||||||
.arg_iter_copied(cx.tcx, args)
|
.iter_instantiated_copied(cx.tcx, args)
|
||||||
.map(|(bound, _)| bound)
|
.map(|(bound, _)| bound)
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
let ty = clean_middle_opaque_bounds(cx, bounds);
|
let ty = clean_middle_opaque_bounds(cx, bounds);
|
||||||
|
|
|
@ -66,7 +66,7 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
|
||||||
if let ty::Alias(ty::Opaque, AliasTy { def_id, args, .. }) = *ret_ty.kind() {
|
if let ty::Alias(ty::Opaque, AliasTy { def_id, args, .. }) = *ret_ty.kind() {
|
||||||
let preds = cx.tcx.explicit_item_bounds(def_id);
|
let preds = cx.tcx.explicit_item_bounds(def_id);
|
||||||
let mut is_future = false;
|
let mut is_future = false;
|
||||||
for (p, _span) in preds.arg_iter_copied(cx.tcx, args) {
|
for (p, _span) in preds.iter_instantiated_copied(cx.tcx, args) {
|
||||||
if let Some(trait_pred) = p.as_trait_clause() {
|
if let Some(trait_pred) = p.as_trait_clause() {
|
||||||
if Some(trait_pred.skip_binder().trait_ref.def_id) == cx.tcx.lang_items().future_trait() {
|
if Some(trait_pred.skip_binder().trait_ref.def_id) == cx.tcx.lang_items().future_trait() {
|
||||||
is_future = true;
|
is_future = true;
|
||||||
|
|
|
@ -663,7 +663,7 @@ pub fn ty_sig<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> Option<ExprFnSig<'t
|
||||||
ty::Alias(ty::Opaque, ty::AliasTy { def_id, args, .. }) => sig_from_bounds(
|
ty::Alias(ty::Opaque, ty::AliasTy { def_id, args, .. }) => sig_from_bounds(
|
||||||
cx,
|
cx,
|
||||||
ty,
|
ty,
|
||||||
cx.tcx.item_bounds(def_id).arg_iter(cx.tcx, args),
|
cx.tcx.item_bounds(def_id).iter_instantiated(cx.tcx, args),
|
||||||
cx.tcx.opt_parent(def_id),
|
cx.tcx.opt_parent(def_id),
|
||||||
),
|
),
|
||||||
ty::FnPtr(sig) => Some(ExprFnSig::Sig(sig, None)),
|
ty::FnPtr(sig) => Some(ExprFnSig::Sig(sig, None)),
|
||||||
|
@ -739,7 +739,7 @@ fn sig_for_projection<'tcx>(cx: &LateContext<'tcx>, ty: AliasTy<'tcx>) -> Option
|
||||||
let mut output = None;
|
let mut output = None;
|
||||||
let lang_items = cx.tcx.lang_items();
|
let lang_items = cx.tcx.lang_items();
|
||||||
|
|
||||||
for (pred, _) in cx.tcx.explicit_item_bounds(ty.def_id).arg_iter_copied(cx.tcx, ty.args) {
|
for (pred, _) in cx.tcx.explicit_item_bounds(ty.def_id).iter_instantiated_copied(cx.tcx, ty.args) {
|
||||||
match pred.kind().skip_binder() {
|
match pred.kind().skip_binder() {
|
||||||
ty::ClauseKind::Trait(p)
|
ty::ClauseKind::Trait(p)
|
||||||
if (lang_items.fn_trait() == Some(p.def_id())
|
if (lang_items.fn_trait() == Some(p.def_id())
|
||||||
|
|
Loading…
Add table
Reference in a new issue