1
Fork 0

Make EarlyBinder's inner value private; and fix all of the resulting errors

This commit is contained in:
Kyle Matsuda 2023-05-26 12:14:48 -06:00
parent 03534ac8b7
commit c40e9cc7ca
16 changed files with 57 additions and 54 deletions

View file

@ -148,11 +148,7 @@ pub(in crate::solve) fn instantiate_constituent_tys_for_sized_trait<'tcx>(
ty::Adt(def, substs) => {
let sized_crit = def.sized_constraint(ecx.tcx());
Ok(sized_crit
.0
.iter()
.map(|ty| sized_crit.rebind(*ty).subst(ecx.tcx(), substs))
.collect())
Ok(sized_crit.subst_iter_copied(ecx.tcx(), substs).collect())
}
}
}

View file

@ -360,7 +360,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
// consider a "quick reject". This avoids creating more types
// and so forth that we need to.
let impl_trait_ref = self.tcx().impl_trait_ref(impl_def_id).unwrap();
if !drcx.substs_refs_may_unify(obligation_substs, impl_trait_ref.0.substs) {
if !drcx
.substs_refs_may_unify(obligation_substs, impl_trait_ref.skip_binder().substs)
{
return;
}
if self.reject_fn_ptr_impls(

View file

@ -527,9 +527,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
substs.extend(trait_predicate.trait_ref.substs.iter());
let mut bound_vars: smallvec::SmallVec<[ty::BoundVariableKind; 8]> =
smallvec::SmallVec::with_capacity(
bound.0.kind().bound_vars().len() + defs.count(),
bound.skip_binder().kind().bound_vars().len() + defs.count(),
);
bound_vars.extend(bound.0.kind().bound_vars().into_iter());
bound_vars.extend(bound.skip_binder().kind().bound_vars().into_iter());
InternalSubsts::fill_single(&mut substs, defs, &mut |param, _| match param
.kind
{

View file

@ -2149,13 +2149,11 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
ty::Adt(def, substs) => {
let sized_crit = def.sized_constraint(self.tcx());
// (*) binder moved here
Where(obligation.predicate.rebind({
sized_crit
.0
.iter()
.map(|ty| sized_crit.rebind(*ty).subst(self.tcx(), substs))
.collect()
}))
Where(
obligation
.predicate
.rebind(sized_crit.subst_iter_copied(self.tcx(), substs).collect()),
)
}
ty::Alias(..) | ty::Param(_) | ty::Placeholder(..) => None,