Add outlives to CoroutineWitnessTypes

This commit is contained in:
Michael Goulet 2025-05-19 10:14:48 +00:00
parent e27f16a499
commit 7976ca2442
5 changed files with 15 additions and 2 deletions

View file

@ -162,6 +162,8 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
type BoundRegion = ty::BoundRegion;
type PlaceholderRegion = ty::PlaceholderRegion;
type RegionAssumptions = &'tcx ty::List<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>>;
type ParamEnv = ty::ParamEnv<'tcx>;
type Predicate = Predicate<'tcx>;
@ -874,6 +876,7 @@ pub struct CtxtInterners<'tcx> {
offset_of: InternedSet<'tcx, List<(VariantIdx, FieldIdx)>>,
valtree: InternedSet<'tcx, ty::ValTreeKind<'tcx>>,
patterns: InternedSet<'tcx, List<ty::Pattern<'tcx>>>,
outlives: InternedSet<'tcx, List<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>>>,
}
impl<'tcx> CtxtInterners<'tcx> {
@ -911,6 +914,7 @@ impl<'tcx> CtxtInterners<'tcx> {
offset_of: InternedSet::with_capacity(N),
valtree: InternedSet::with_capacity(N),
patterns: InternedSet::with_capacity(N),
outlives: InternedSet::with_capacity(N),
}
}
@ -2692,6 +2696,7 @@ slice_interners!(
captures: intern_captures(&'tcx ty::CapturedPlace<'tcx>),
offset_of: pub mk_offset_of((VariantIdx, FieldIdx)),
patterns: pub mk_patterns(Pattern<'tcx>),
outlives: pub mk_outlives(ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>),
);
impl<'tcx> TyCtxt<'tcx> {

View file

@ -802,4 +802,5 @@ list_fold! {
&'tcx ty::List<ty::PolyExistentialPredicate<'tcx>> : mk_poly_existential_predicates,
&'tcx ty::List<PlaceElem<'tcx>> : mk_place_elems,
&'tcx ty::List<ty::Pattern<'tcx>> : mk_patterns,
&'tcx ty::List<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>> : mk_outlives,
}

View file

@ -29,9 +29,8 @@ pub(crate) fn coroutine_hidden_types<'tcx>(
ty
}),
);
ty::EarlyBinder::bind(ty::Binder::bind_with_vars(
ty::CoroutineWitnessTypes { types: bound_tys },
ty::CoroutineWitnessTypes { types: bound_tys, assumptions: ty::List::empty() },
tcx.mk_bound_variable_kinds(&vars),
))
}

View file

@ -145,6 +145,13 @@ pub trait Interner:
type BoundRegion: BoundVarLike<Self>;
type PlaceholderRegion: PlaceholderLike<Self, Bound = Self::BoundRegion>;
type RegionAssumptions: Copy
+ Debug
+ Hash
+ Eq
+ SliceLike<Item = ty::OutlivesPredicate<Self, Self::GenericArg>>
+ TypeFoldable<Self>;
// Predicates
type ParamEnv: ParamEnv<Self>;
type Predicate: Predicate<Self>;

View file

@ -1150,4 +1150,5 @@ pub struct FnHeader<I: Interner> {
#[derive(TypeVisitable_Generic, TypeFoldable_Generic, Lift_Generic)]
pub struct CoroutineWitnessTypes<I: Interner> {
pub types: I::Tys,
pub assumptions: I::RegionAssumptions,
}