Skip to content

Commit fc52758

Browse files
Add outlives to CoroutineWitnessTypes
1 parent e43d139 commit fc52758

File tree

5 files changed

+15
-2
lines changed

5 files changed

+15
-2
lines changed

compiler/rustc_middle/src/ty/context.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
162162
type BoundRegion = ty::BoundRegion;
163163
type PlaceholderRegion = ty::PlaceholderRegion;
164164

165+
type RegionAssumptions = &'tcx ty::List<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>>;
166+
165167
type ParamEnv = ty::ParamEnv<'tcx>;
166168
type Predicate = Predicate<'tcx>;
167169

@@ -874,6 +876,7 @@ pub struct CtxtInterners<'tcx> {
874876
offset_of: InternedSet<'tcx, List<(VariantIdx, FieldIdx)>>,
875877
valtree: InternedSet<'tcx, ty::ValTreeKind<'tcx>>,
876878
patterns: InternedSet<'tcx, List<ty::Pattern<'tcx>>>,
879+
outlives: InternedSet<'tcx, List<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>>>,
877880
}
878881

879882
impl<'tcx> CtxtInterners<'tcx> {
@@ -911,6 +914,7 @@ impl<'tcx> CtxtInterners<'tcx> {
911914
offset_of: InternedSet::with_capacity(N),
912915
valtree: InternedSet::with_capacity(N),
913916
patterns: InternedSet::with_capacity(N),
917+
outlives: InternedSet::with_capacity(N),
914918
}
915919
}
916920

@@ -2692,6 +2696,7 @@ slice_interners!(
26922696
captures: intern_captures(&'tcx ty::CapturedPlace<'tcx>),
26932697
offset_of: pub mk_offset_of((VariantIdx, FieldIdx)),
26942698
patterns: pub mk_patterns(Pattern<'tcx>),
2699+
outlives: pub mk_outlives(ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>),
26952700
);
26962701

26972702
impl<'tcx> TyCtxt<'tcx> {

compiler/rustc_middle/src/ty/structural_impls.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,4 +802,5 @@ list_fold! {
802802
&'tcx ty::List<ty::PolyExistentialPredicate<'tcx>> : mk_poly_existential_predicates,
803803
&'tcx ty::List<PlaceElem<'tcx>> : mk_place_elems,
804804
&'tcx ty::List<ty::Pattern<'tcx>> : mk_patterns,
805+
&'tcx ty::List<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>> : mk_outlives,
805806
}

compiler/rustc_traits/src/coroutine_witnesses.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ pub(crate) fn coroutine_hidden_types<'tcx>(
2929
ty
3030
}),
3131
);
32-
3332
ty::EarlyBinder::bind(ty::Binder::bind_with_vars(
34-
ty::CoroutineWitnessTypes { types: bound_tys },
33+
ty::CoroutineWitnessTypes { types: bound_tys, assumptions: ty::List::empty() },
3534
tcx.mk_bound_variable_kinds(&vars),
3635
))
3736
}

compiler/rustc_type_ir/src/interner.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,13 @@ pub trait Interner:
145145
type BoundRegion: BoundVarLike<Self>;
146146
type PlaceholderRegion: PlaceholderLike<Self, Bound = Self::BoundRegion>;
147147

148+
type RegionAssumptions: Copy
149+
+ Debug
150+
+ Hash
151+
+ Eq
152+
+ SliceLike<Item = ty::OutlivesPredicate<Self, Self::GenericArg>>
153+
+ TypeFoldable<Self>;
154+
148155
// Predicates
149156
type ParamEnv: ParamEnv<Self>;
150157
type Predicate: Predicate<Self>;

compiler/rustc_type_ir/src/ty_kind.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,4 +1150,5 @@ pub struct FnHeader<I: Interner> {
11501150
#[derive(TypeVisitable_Generic, TypeFoldable_Generic, Lift_Generic)]
11511151
pub struct CoroutineWitnessTypes<I: Interner> {
11521152
pub types: I::Tys,
1153+
pub assumptions: I::RegionAssumptions,
11531154
}

0 commit comments

Comments
 (0)