1
Fork 0

Do binder folding eagerly in bound_coroutine_hidden_types

I refuse to fix this in the old solver; its lazy instantiation of
binders will be the end of me.
This commit is contained in:
Michael Goulet 2024-03-14 11:51:22 -04:00
parent 67f1c53c05
commit bca708b9fa
3 changed files with 42 additions and 37 deletions

View file

@ -14,7 +14,7 @@ use rustc_infer::infer::{DefineOpaqueTypes, InferOk};
use rustc_middle::traits::{BuiltinImplSource, SignatureMismatchData};
use rustc_middle::ty::{
self, GenericArgs, GenericArgsRef, GenericParamDefKind, ToPolyTraitRef, ToPredicate,
TraitPredicate, Ty, TyCtxt, TypeVisitableExt,
TraitPredicate, Ty, TyCtxt,
};
use rustc_span::def_id::DefId;
@ -1438,10 +1438,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
}
ty::CoroutineWitness(def_id, args) => {
let tcx = self.tcx();
stack.extend(tcx.coroutine_hidden_types(def_id).map(|bty| {
let ty = bty.instantiate(tcx, args);
debug_assert!(!ty.has_bound_regions());
ty
stack.extend(tcx.bound_coroutine_hidden_types(def_id).map(|bty| {
self.infcx.enter_forall_and_leak_universe(bty.instantiate(tcx, args))
}))
}