@@ -36,7 +36,7 @@ use mir::interpret::Allocation;
36
36
use ty:: subst:: { CanonicalSubsts , Kind , Substs , Subst } ;
37
37
use ty:: ReprOptions ;
38
38
use traits;
39
- use traits:: { Clause , Clauses , Goal , Goals } ;
39
+ use traits:: { Clause , Clauses , GoalKind , Goal , Goals } ;
40
40
use ty:: { self , Ty , TypeAndMut } ;
41
41
use ty:: { TyS , TyKind , List } ;
42
42
use ty:: { AdtKind , AdtDef , ClosureSubsts , GeneratorSubsts , Region , Const } ;
@@ -143,7 +143,8 @@ pub struct CtxtInterners<'tcx> {
143
143
predicates : InternedSet < ' tcx , List < Predicate < ' tcx > > > ,
144
144
const_ : InternedSet < ' tcx , Const < ' tcx > > ,
145
145
clauses : InternedSet < ' tcx , List < Clause < ' tcx > > > ,
146
- goals : InternedSet < ' tcx , List < Goal < ' tcx > > > ,
146
+ goal : InternedSet < ' tcx , GoalKind < ' tcx > > ,
147
+ goal_list : InternedSet < ' tcx , List < Goal < ' tcx > > > ,
147
148
}
148
149
149
150
impl < ' gcx : ' tcx , ' tcx > CtxtInterners < ' tcx > {
@@ -159,7 +160,8 @@ impl<'gcx: 'tcx, 'tcx> CtxtInterners<'tcx> {
159
160
predicates : Default :: default ( ) ,
160
161
const_ : Default :: default ( ) ,
161
162
clauses : Default :: default ( ) ,
162
- goals : Default :: default ( ) ,
163
+ goal : Default :: default ( ) ,
164
+ goal_list : Default :: default ( ) ,
163
165
}
164
166
}
165
167
@@ -1731,9 +1733,9 @@ impl<'a, 'tcx> Lift<'tcx> for Region<'a> {
1731
1733
}
1732
1734
}
1733
1735
1734
- impl < ' a , ' tcx > Lift < ' tcx > for & ' a Goal < ' a > {
1735
- type Lifted = & ' tcx Goal < ' tcx > ;
1736
- fn lift_to_tcx < ' b , ' gcx > ( & self , tcx : TyCtxt < ' b , ' gcx , ' tcx > ) -> Option < & ' tcx Goal < ' tcx > > {
1736
+ impl < ' a , ' tcx > Lift < ' tcx > for Goal < ' a > {
1737
+ type Lifted = Goal < ' tcx > ;
1738
+ fn lift_to_tcx < ' b , ' gcx > ( & self , tcx : TyCtxt < ' b , ' gcx , ' tcx > ) -> Option < Goal < ' tcx > > {
1737
1739
if tcx. interners . arena . in_arena ( * self as * const _ ) {
1738
1740
return Some ( unsafe { mem:: transmute ( * self ) } ) ;
1739
1741
}
@@ -2304,6 +2306,12 @@ impl<'tcx> Borrow<RegionKind> for Interned<'tcx, RegionKind> {
2304
2306
}
2305
2307
}
2306
2308
2309
+ impl < ' tcx : ' lcx , ' lcx > Borrow < GoalKind < ' lcx > > for Interned < ' tcx , GoalKind < ' tcx > > {
2310
+ fn borrow < ' a > ( & ' a self ) -> & ' a GoalKind < ' lcx > {
2311
+ & self . 0
2312
+ }
2313
+ }
2314
+
2307
2315
impl < ' tcx : ' lcx , ' lcx > Borrow < [ ExistentialPredicate < ' lcx > ] >
2308
2316
for Interned < ' tcx , List < ExistentialPredicate < ' tcx > > > {
2309
2317
fn borrow < ' a > ( & ' a self ) -> & ' a [ ExistentialPredicate < ' lcx > ] {
@@ -2419,7 +2427,8 @@ pub fn keep_local<'tcx, T: ty::TypeFoldable<'tcx>>(x: &T) -> bool {
2419
2427
2420
2428
direct_interners ! ( ' tcx,
2421
2429
region: mk_region( |r: & RegionKind | r. keep_in_local_tcx( ) ) -> RegionKind ,
2422
- const_: mk_const( |c: & Const <' _>| keep_local( & c. ty) || keep_local( & c. val) ) -> Const <' tcx>
2430
+ const_: mk_const( |c: & Const <' _>| keep_local( & c. ty) || keep_local( & c. val) ) -> Const <' tcx>,
2431
+ goal: mk_goal( |c: & GoalKind <' _>| keep_local( c) ) -> GoalKind <' tcx>
2423
2432
) ;
2424
2433
2425
2434
macro_rules! slice_interners {
@@ -2438,7 +2447,7 @@ slice_interners!(
2438
2447
type_list: _intern_type_list( Ty ) ,
2439
2448
substs: _intern_substs( Kind ) ,
2440
2449
clauses: _intern_clauses( Clause ) ,
2441
- goals : _intern_goals( Goal )
2450
+ goal_list : _intern_goals( Goal )
2442
2451
) ;
2443
2452
2444
2453
// This isn't a perfect fit: CanonicalVarInfo slices are always
@@ -2818,10 +2827,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
2818
2827
iter. intern_with ( |xs| self . intern_goals ( xs) )
2819
2828
}
2820
2829
2821
- pub fn mk_goal ( self , goal : Goal < ' tcx > ) -> & ' tcx Goal < ' _ > {
2822
- & self . intern_goals ( & [ goal] ) [ 0 ]
2823
- }
2824
-
2825
2830
pub fn lint_hir < S : Into < MultiSpan > > ( self ,
2826
2831
lint : & ' static Lint ,
2827
2832
hir_id : HirId ,
0 commit comments