@@ -30,7 +30,10 @@ use crate::ty::{self, DefIdTree, Ty, TypeAndMut};
30
30
use crate :: ty:: { AdtDef , AdtKind , Const , Region } ;
31
31
use crate :: ty:: { BindingMode , BoundVar } ;
32
32
use 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
+ } ;
34
37
use crate :: ty:: { InferConst , ParamConst } ;
35
38
use crate :: ty:: { List , TyKind , TyS } ;
36
39
use rustc_ast:: ast;
@@ -91,6 +94,7 @@ pub struct CtxtInterners<'tcx> {
91
94
canonical_var_infos : InternedSet < ' tcx , List < CanonicalVarInfo > > ,
92
95
region : InternedSet < ' tcx , RegionKind > ,
93
96
existential_predicates : InternedSet < ' tcx , List < ExistentialPredicate < ' tcx > > > ,
97
+ region_outlives_predicates : InternedSet < ' tcx , List < RegionOutlivesPredicate < ' tcx > > > ,
94
98
predicates : InternedSet < ' tcx , List < Predicate < ' tcx > > > ,
95
99
clauses : InternedSet < ' tcx , List < Clause < ' tcx > > > ,
96
100
goal : InternedSet < ' tcx , GoalKind < ' tcx > > ,
@@ -109,6 +113,7 @@ impl<'tcx> CtxtInterners<'tcx> {
109
113
substs : Default :: default ( ) ,
110
114
region : Default :: default ( ) ,
111
115
existential_predicates : Default :: default ( ) ,
116
+ region_outlives_predicates : Default :: default ( ) ,
112
117
canonical_var_infos : Default :: default ( ) ,
113
118
predicates : Default :: default ( ) ,
114
119
clauses : Default :: default ( ) ,
@@ -1588,6 +1593,7 @@ nop_list_lift! {goal_list; Goal<'a> => Goal<'tcx>}
1588
1593
nop_list_lift ! { clauses; Clause <' a> => Clause <' tcx>}
1589
1594
nop_list_lift ! { type_list; Ty <' a> => Ty <' tcx>}
1590
1595
nop_list_lift ! { existential_predicates; ExistentialPredicate <' a> => ExistentialPredicate <' tcx>}
1596
+ nop_list_lift ! { region_outlives_predicates; RegionOutlivesPredicate <' a> => RegionOutlivesPredicate <' tcx>}
1591
1597
nop_list_lift ! { predicates; Predicate <' a> => Predicate <' tcx>}
1592
1598
nop_list_lift ! { canonical_var_infos; CanonicalVarInfo => CanonicalVarInfo }
1593
1599
nop_list_lift ! { projs; ProjectionKind => ProjectionKind }
@@ -2010,6 +2016,14 @@ impl<'tcx> Borrow<[ExistentialPredicate<'tcx>]>
2010
2016
}
2011
2017
}
2012
2018
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
+
2013
2027
impl < ' tcx > Borrow < [ Predicate < ' tcx > ] > for Interned < ' tcx , List < Predicate < ' tcx > > > {
2014
2028
fn borrow < ' a > ( & ' a self ) -> & ' a [ Predicate < ' tcx > ] {
2015
2029
& self . 0 [ ..]
@@ -2083,6 +2097,7 @@ slice_interners!(
2083
2097
substs: _intern_substs( GenericArg <' tcx>) ,
2084
2098
canonical_var_infos: _intern_canonical_var_infos( CanonicalVarInfo ) ,
2085
2099
existential_predicates: _intern_existential_predicates( ExistentialPredicate <' tcx>) ,
2100
+ region_outlives_predicates: _intern_region_outlive_predicates( RegionOutlivesPredicate <' tcx>) ,
2086
2101
predicates: _intern_predicates( Predicate <' tcx>) ,
2087
2102
clauses: _intern_clauses( Clause <' tcx>) ,
2088
2103
goal_list: _intern_goals( Goal <' tcx>) ,
@@ -2332,7 +2347,7 @@ impl<'tcx> TyCtxt<'tcx> {
2332
2347
pub fn mk_generator_witness (
2333
2348
self ,
2334
2349
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 > > > ,
2336
2351
) -> Ty < ' tcx > {
2337
2352
self . mk_ty ( GeneratorWitness ( types, region_outlives) )
2338
2353
}
@@ -2445,6 +2460,16 @@ impl<'tcx> TyCtxt<'tcx> {
2445
2460
self . _intern_existential_predicates ( eps)
2446
2461
}
2447
2462
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
+ }
2448
2473
pub fn intern_predicates ( self , preds : & [ Predicate < ' tcx > ] ) -> & ' tcx List < Predicate < ' tcx > > {
2449
2474
// FIXME consider asking the input slice to be sorted to avoid
2450
2475
// re-interning permutations, in which case that would be asserted
@@ -2513,6 +2538,15 @@ impl<'tcx> TyCtxt<'tcx> {
2513
2538
iter. intern_with ( |xs| self . intern_existential_predicates ( xs) )
2514
2539
}
2515
2540
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
+
2516
2550
pub fn mk_predicates < I : InternAs < [ Predicate < ' tcx > ] , & ' tcx List < Predicate < ' tcx > > > > (
2517
2551
self ,
2518
2552
iter : I ,
0 commit comments