@@ -29,10 +29,9 @@ use crate::ty::{self, DefIdTree, Ty, TypeAndMut};
29
29
use crate :: ty:: { AdtDef , AdtKind , Const , Region } ;
30
30
use crate :: ty:: { BindingMode , BoundVar } ;
31
31
use crate :: ty:: { ConstVid , FloatVar , FloatVid , IntVar , IntVid , TyVar , TyVid } ;
32
- use crate :: ty:: {
33
- ExistentialPredicate , InferTy , ParamTy , PolyFnSig , Predicate , PredicateKind , ProjectionTy ,
34
- } ;
32
+ use crate :: ty:: { ExistentialPredicate , Predicate , PredicateKind } ;
35
33
use crate :: ty:: { InferConst , ParamConst } ;
34
+ use crate :: ty:: { InferTy , ParamTy , PolyFnSig , ProjectionTy } ;
36
35
use crate :: ty:: { List , TyKind , TyS } ;
37
36
use rustc_ast:: ast;
38
37
use rustc_ast:: expand:: allocator:: AllocatorKind ;
@@ -91,6 +90,7 @@ pub struct CtxtInterners<'tcx> {
91
90
canonical_var_infos : InternedSet < ' tcx , List < CanonicalVarInfo > > ,
92
91
region : InternedSet < ' tcx , RegionKind > ,
93
92
existential_predicates : InternedSet < ' tcx , List < ExistentialPredicate < ' tcx > > > ,
93
+ predicate_kind : InternedSet < ' tcx , PredicateKind < ' tcx > > ,
94
94
predicates : InternedSet < ' tcx , List < Predicate < ' tcx > > > ,
95
95
projs : InternedSet < ' tcx , List < ProjectionKind > > ,
96
96
place_elems : InternedSet < ' tcx , List < PlaceElem < ' tcx > > > ,
@@ -109,6 +109,7 @@ impl<'tcx> CtxtInterners<'tcx> {
109
109
region : Default :: default ( ) ,
110
110
existential_predicates : Default :: default ( ) ,
111
111
canonical_var_infos : Default :: default ( ) ,
112
+ predicate_kind : Default :: default ( ) ,
112
113
predicates : Default :: default ( ) ,
113
114
projs : Default :: default ( ) ,
114
115
place_elems : Default :: default ( ) ,
@@ -1579,6 +1580,7 @@ macro_rules! nop_list_lift {
1579
1580
nop_lift ! { type_; Ty <' a> => Ty <' tcx>}
1580
1581
nop_lift ! { region; Region <' a> => Region <' tcx>}
1581
1582
nop_lift ! { const_; & ' a Const <' a> => & ' tcx Const <' tcx>}
1583
+ nop_lift ! { predicate_kind; & ' a PredicateKind <' a> => & ' tcx PredicateKind <' tcx>}
1582
1584
1583
1585
nop_list_lift ! { type_list; Ty <' a> => Ty <' tcx>}
1584
1586
nop_list_lift ! { existential_predicates; ExistentialPredicate <' a> => ExistentialPredicate <' tcx>}
@@ -2017,8 +2019,14 @@ impl<'tcx> Borrow<[traits::ChalkEnvironmentClause<'tcx>]>
2017
2019
}
2018
2020
}
2019
2021
2022
+ impl < ' tcx > Borrow < PredicateKind < ' tcx > > for Interned < ' tcx , PredicateKind < ' tcx > > {
2023
+ fn borrow < ' a > ( & ' a self ) -> & ' a PredicateKind < ' tcx > {
2024
+ & self . 0
2025
+ }
2026
+ }
2027
+
2020
2028
macro_rules! direct_interners {
2021
- ( $( $name: ident: $method: ident( $ty: ty) ) , +) => {
2029
+ ( $( $name: ident: $method: ident( $ty: ty) , ) +) => {
2022
2030
$( impl <' tcx> PartialEq for Interned <' tcx, $ty> {
2023
2031
fn eq( & self , other: & Self ) -> bool {
2024
2032
self . 0 == other. 0
@@ -2043,7 +2051,11 @@ macro_rules! direct_interners {
2043
2051
}
2044
2052
}
2045
2053
2046
- direct_interners ! ( region: mk_region( RegionKind ) , const_: mk_const( Const <' tcx>) ) ;
2054
+ direct_interners ! (
2055
+ region: mk_region( RegionKind ) ,
2056
+ const_: mk_const( Const <' tcx>) ,
2057
+ predicate_kind: intern_predicate_kind( PredicateKind <' tcx>) ,
2058
+ ) ;
2047
2059
2048
2060
macro_rules! slice_interners {
2049
2061
( $( $field: ident: $method: ident( $ty: ty) ) ,+) => (
@@ -2107,6 +2119,7 @@ impl<'tcx> TyCtxt<'tcx> {
2107
2119
2108
2120
#[ inline]
2109
2121
pub fn mk_predicate ( & self , kind : PredicateKind < ' tcx > ) -> Predicate < ' tcx > {
2122
+ let kind = self . intern_predicate_kind ( kind) ;
2110
2123
Predicate { kind }
2111
2124
}
2112
2125
0 commit comments