@@ -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
@@ -1766,9 +1768,9 @@ impl<'a, 'tcx> Lift<'tcx> for Region<'a> {
1766
1768
}
1767
1769
}
1768
1770
1769
- impl < ' a , ' tcx > Lift < ' tcx > for & ' a Goal < ' a > {
1770
- type Lifted = & ' tcx Goal < ' tcx > ;
1771
- fn lift_to_tcx < ' b , ' gcx > ( & self , tcx : TyCtxt < ' b , ' gcx , ' tcx > ) -> Option < & ' tcx Goal < ' tcx > > {
1771
+ impl < ' a , ' tcx > Lift < ' tcx > for Goal < ' a > {
1772
+ type Lifted = Goal < ' tcx > ;
1773
+ fn lift_to_tcx < ' b , ' gcx > ( & self , tcx : TyCtxt < ' b , ' gcx , ' tcx > ) -> Option < Goal < ' tcx > > {
1772
1774
if tcx. interners . arena . in_arena ( * self as * const _ ) {
1773
1775
return Some ( unsafe { mem:: transmute ( * self ) } ) ;
1774
1776
}
@@ -2340,6 +2342,12 @@ impl<'tcx> Borrow<RegionKind> for Interned<'tcx, RegionKind> {
2340
2342
}
2341
2343
}
2342
2344
2345
+ impl < ' tcx : ' lcx , ' lcx > Borrow < GoalKind < ' lcx > > for Interned < ' tcx , GoalKind < ' tcx > > {
2346
+ fn borrow < ' a > ( & ' a self ) -> & ' a GoalKind < ' lcx > {
2347
+ & self . 0
2348
+ }
2349
+ }
2350
+
2343
2351
impl < ' tcx : ' lcx , ' lcx > Borrow < [ ExistentialPredicate < ' lcx > ] >
2344
2352
for Interned < ' tcx , List < ExistentialPredicate < ' tcx > > > {
2345
2353
fn borrow < ' a > ( & ' a self ) -> & ' a [ ExistentialPredicate < ' lcx > ] {
@@ -2455,7 +2463,8 @@ pub fn keep_local<'tcx, T: ty::TypeFoldable<'tcx>>(x: &T) -> bool {
2455
2463
2456
2464
direct_interners ! ( ' tcx,
2457
2465
region: mk_region( |r: & RegionKind | r. keep_in_local_tcx( ) ) -> RegionKind ,
2458
- const_: mk_const( |c: & Const <' _>| keep_local( & c. ty) || keep_local( & c. val) ) -> Const <' tcx>
2466
+ const_: mk_const( |c: & Const <' _>| keep_local( & c. ty) || keep_local( & c. val) ) -> Const <' tcx>,
2467
+ goal: mk_goal( |c: & GoalKind <' _>| keep_local( c) ) -> GoalKind <' tcx>
2459
2468
) ;
2460
2469
2461
2470
macro_rules! slice_interners {
@@ -2474,7 +2483,7 @@ slice_interners!(
2474
2483
type_list: _intern_type_list( Ty ) ,
2475
2484
substs: _intern_substs( Kind ) ,
2476
2485
clauses: _intern_clauses( Clause ) ,
2477
- goals : _intern_goals( Goal )
2486
+ goal_list : _intern_goals( Goal )
2478
2487
) ;
2479
2488
2480
2489
// This isn't a perfect fit: CanonicalVarInfo slices are always
@@ -2854,10 +2863,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
2854
2863
iter. intern_with ( |xs| self . intern_goals ( xs) )
2855
2864
}
2856
2865
2857
- pub fn mk_goal ( self , goal : Goal < ' tcx > ) -> & ' tcx Goal < ' _ > {
2858
- & self . intern_goals ( & [ goal] ) [ 0 ]
2859
- }
2860
-
2861
2866
pub fn lint_hir < S : Into < MultiSpan > > ( self ,
2862
2867
lint : & ' static Lint ,
2863
2868
hir_id : HirId ,
0 commit comments