@@ -30,7 +30,10 @@ use crate::ty::{self, DefIdTree, Ty, TypeAndMut};
3030use crate :: ty:: { AdtDef , AdtKind , Const , Region } ;
3131use crate :: ty:: { BindingMode , BoundVar } ;
3232use crate :: ty:: { ConstVid , FloatVar , FloatVid , IntVar , IntVid , TyVar , TyVid } ;
33- use crate :: ty:: { ExistentialPredicate , InferTy , ParamTy , PolyFnSig , Predicate , ProjectionTy } ;
33+ use crate :: ty:: {
34+ ExistentialPredicate , InferTy , ParamTy , PolyFnSig , Predicate , ProjectionTy ,
35+ RegionOutlivesPredicate ,
36+ } ;
3437use crate :: ty:: { InferConst , ParamConst } ;
3538use crate :: ty:: { List , TyKind , TyS } ;
3639use rustc_ast:: ast;
@@ -91,6 +94,7 @@ pub struct CtxtInterners<'tcx> {
9194 canonical_var_infos : InternedSet < ' tcx , List < CanonicalVarInfo > > ,
9295 region : InternedSet < ' tcx , RegionKind > ,
9396 existential_predicates : InternedSet < ' tcx , List < ExistentialPredicate < ' tcx > > > ,
97+ region_outlives_predicates : InternedSet < ' tcx , List < RegionOutlivesPredicate < ' tcx > > > ,
9498 predicates : InternedSet < ' tcx , List < Predicate < ' tcx > > > ,
9599 clauses : InternedSet < ' tcx , List < Clause < ' tcx > > > ,
96100 goal : InternedSet < ' tcx , GoalKind < ' tcx > > ,
@@ -109,6 +113,7 @@ impl<'tcx> CtxtInterners<'tcx> {
109113 substs : Default :: default ( ) ,
110114 region : Default :: default ( ) ,
111115 existential_predicates : Default :: default ( ) ,
116+ region_outlives_predicates : Default :: default ( ) ,
112117 canonical_var_infos : Default :: default ( ) ,
113118 predicates : Default :: default ( ) ,
114119 clauses : Default :: default ( ) ,
@@ -1588,6 +1593,7 @@ nop_list_lift! {goal_list; Goal<'a> => Goal<'tcx>}
15881593nop_list_lift ! { clauses; Clause <' a> => Clause <' tcx>}
15891594nop_list_lift ! { type_list; Ty <' a> => Ty <' tcx>}
15901595nop_list_lift ! { existential_predicates; ExistentialPredicate <' a> => ExistentialPredicate <' tcx>}
1596+ nop_list_lift ! { region_outlives_predicates; RegionOutlivesPredicate <' a> => RegionOutlivesPredicate <' tcx>}
15911597nop_list_lift ! { predicates; Predicate <' a> => Predicate <' tcx>}
15921598nop_list_lift ! { canonical_var_infos; CanonicalVarInfo => CanonicalVarInfo }
15931599nop_list_lift ! { projs; ProjectionKind => ProjectionKind }
@@ -2010,6 +2016,14 @@ impl<'tcx> Borrow<[ExistentialPredicate<'tcx>]>
20102016 }
20112017}
20122018
2019+ impl < ' tcx > Borrow < [ RegionOutlivesPredicate < ' tcx > ] >
2020+ for Interned < ' tcx , List < RegionOutlivesPredicate < ' tcx > > >
2021+ {
2022+ fn borrow < ' a > ( & ' a self ) -> & ' a [ RegionOutlivesPredicate < ' tcx > ] {
2023+ & self . 0 [ ..]
2024+ }
2025+ }
2026+
20132027impl < ' tcx > Borrow < [ Predicate < ' tcx > ] > for Interned < ' tcx , List < Predicate < ' tcx > > > {
20142028 fn borrow < ' a > ( & ' a self ) -> & ' a [ Predicate < ' tcx > ] {
20152029 & self . 0 [ ..]
@@ -2083,6 +2097,7 @@ slice_interners!(
20832097 substs: _intern_substs( GenericArg <' tcx>) ,
20842098 canonical_var_infos: _intern_canonical_var_infos( CanonicalVarInfo ) ,
20852099 existential_predicates: _intern_existential_predicates( ExistentialPredicate <' tcx>) ,
2100+ region_outlives_predicates: _intern_region_outlive_predicates( RegionOutlivesPredicate <' tcx>) ,
20862101 predicates: _intern_predicates( Predicate <' tcx>) ,
20872102 clauses: _intern_clauses( Clause <' tcx>) ,
20882103 goal_list: _intern_goals( Goal <' tcx>) ,
@@ -2332,7 +2347,7 @@ impl<'tcx> TyCtxt<'tcx> {
23322347 pub fn mk_generator_witness (
23332348 self ,
23342349 types : ty:: Binder < & ' tcx List < Ty < ' tcx > > > ,
2335- region_outlives : ty:: Binder < & ' tcx List < Predicate < ' tcx > > > ,
2350+ region_outlives : ty:: Binder < & ' tcx List < RegionOutlivesPredicate < ' tcx > > > ,
23362351 ) -> Ty < ' tcx > {
23372352 self . mk_ty ( GeneratorWitness ( types, region_outlives) )
23382353 }
@@ -2445,6 +2460,16 @@ impl<'tcx> TyCtxt<'tcx> {
24452460 self . _intern_existential_predicates ( eps)
24462461 }
24472462
2463+ pub fn intern_region_outlives_predicates (
2464+ self ,
2465+ predicates : & [ RegionOutlivesPredicate < ' tcx > ] ,
2466+ ) -> & ' tcx List < RegionOutlivesPredicate < ' tcx > > {
2467+ if predicates. is_empty ( ) {
2468+ List :: empty ( )
2469+ } else {
2470+ self . _intern_region_outlive_predicates ( predicates)
2471+ }
2472+ }
24482473 pub fn intern_predicates ( self , preds : & [ Predicate < ' tcx > ] ) -> & ' tcx List < Predicate < ' tcx > > {
24492474 // FIXME consider asking the input slice to be sorted to avoid
24502475 // re-interning permutations, in which case that would be asserted
@@ -2513,6 +2538,15 @@ impl<'tcx> TyCtxt<'tcx> {
25132538 iter. intern_with ( |xs| self . intern_existential_predicates ( xs) )
25142539 }
25152540
2541+ pub fn mk_region_outlives_predicates <
2542+ I : InternAs < [ RegionOutlivesPredicate < ' tcx > ] , & ' tcx List < RegionOutlivesPredicate < ' tcx > > > ,
2543+ > (
2544+ self ,
2545+ iter : I ,
2546+ ) -> I :: Output {
2547+ iter. intern_with ( |xs| self . intern_region_outlives_predicates ( xs) )
2548+ }
2549+
25162550 pub fn mk_predicates < I : InternAs < [ Predicate < ' tcx > ] , & ' tcx List < Predicate < ' tcx > > > > (
25172551 self ,
25182552 iter : I ,
0 commit comments