@@ -728,6 +728,26 @@ impl<I: Interner> TyKind<I> {
728
728
dyn_flags |= alias_eq. alias . compute_flags ( interner) ;
729
729
dyn_flags |= alias_eq. ty . data ( interner) . flags ;
730
730
}
731
+ WhereClause :: ConstEq ( ct_eq) => {
732
+ // TODO it's not a type projection but is that fine?
733
+ // TODO do I need to add other flags here?
734
+ dyn_flags |= TypeFlags :: HAS_TY_PROJECTION ;
735
+ let const_data = ct_eq. ct . data ( interner) ;
736
+ dyn_flags |= const_data. ty . data ( interner) . flags
737
+ | match const_data. value {
738
+ ConstValue :: BoundVar ( _) | ConstValue :: Concrete ( _) => {
739
+ TypeFlags :: empty ( )
740
+ }
741
+ ConstValue :: InferenceVar ( _) => {
742
+ TypeFlags :: HAS_CT_INFER
743
+ | TypeFlags :: STILL_FURTHER_SPECIALIZABLE
744
+ }
745
+ ConstValue :: Placeholder ( _) => {
746
+ TypeFlags :: HAS_CT_PLACEHOLDER
747
+ | TypeFlags :: STILL_FURTHER_SPECIALIZABLE
748
+ }
749
+ }
750
+ }
731
751
WhereClause :: LifetimeOutlives ( lifetime_outlives) => {
732
752
dyn_flags |= lifetime_outlives. a . compute_flags ( interner)
733
753
| lifetime_outlives. b . compute_flags ( interner) ;
@@ -1743,13 +1763,16 @@ pub enum WhereClause<I: Interner> {
1743
1763
LifetimeOutlives ( LifetimeOutlives < I > ) ,
1744
1764
/// Type outlives a lifetime.
1745
1765
TypeOutlives ( TypeOutlives < I > ) ,
1766
+ /// Const is equal to another const
1767
+ ConstEq ( ConstEq < I > ) ,
1746
1768
}
1747
1769
1748
1770
impl < I : Interner > Copy for WhereClause < I >
1749
1771
where
1750
1772
I :: InternedSubstitution : Copy ,
1751
1773
I :: InternedLifetime : Copy ,
1752
1774
I :: InternedType : Copy ,
1775
+ I :: InternedConst : Copy ,
1753
1776
{
1754
1777
}
1755
1778
@@ -1908,6 +1931,7 @@ where
1908
1931
I :: InternedSubstitution : Copy ,
1909
1932
I :: InternedLifetime : Copy ,
1910
1933
I :: InternedType : Copy ,
1934
+ I :: InternedConst : Copy ,
1911
1935
{
1912
1936
}
1913
1937
@@ -1939,6 +1963,7 @@ impl<I: Interner> WhereClause<I> {
1939
1963
match self {
1940
1964
WhereClause :: Implemented ( trait_ref) => Some ( trait_ref. trait_id ) ,
1941
1965
WhereClause :: AliasEq ( _) => None ,
1966
+ WhereClause :: ConstEq ( _) => None ,
1942
1967
WhereClause :: LifetimeOutlives ( _) => None ,
1943
1968
WhereClause :: TypeOutlives ( _) => None ,
1944
1969
}
@@ -2046,6 +2071,26 @@ impl<I: Interner> HasInterner for AliasEq<I> {
2046
2071
type Interner = I ;
2047
2072
}
2048
2073
2074
+ /// Proves **equality** between an alias and a type.
2075
+ #[ derive( Clone , PartialEq , Eq , Hash , Fold , Visit , Zip ) ]
2076
+ #[ allow( missing_docs) ]
2077
+ pub struct ConstEq < I : Interner > {
2078
+ /// The id for the associated type member.
2079
+ pub term : AssocItemId < I > ,
2080
+
2081
+ pub ct : Const < I > ,
2082
+ }
2083
+ impl < I : Interner > Copy for ConstEq < I >
2084
+ where
2085
+ I :: InternedSubstitution : Copy ,
2086
+ I :: InternedConst : Copy ,
2087
+ {
2088
+ }
2089
+
2090
+ impl < I : Interner > HasInterner for ConstEq < I > {
2091
+ type Interner = I ;
2092
+ }
2093
+
2049
2094
/// Indicates that the `value` is universally quantified over `N`
2050
2095
/// parameters of the given kinds, where `N == self.binders.len()`. A
2051
2096
/// variable with depth `i < N` refers to the value at
@@ -2610,6 +2655,7 @@ pub enum GoalData<I: Interner> {
2610
2655
impl < I : Interner > Copy for GoalData < I >
2611
2656
where
2612
2657
I :: InternedType : Copy ,
2658
+ I :: InternedConst : Copy ,
2613
2659
I :: InternedLifetime : Copy ,
2614
2660
I :: InternedGenericArg : Copy ,
2615
2661
I :: InternedSubstitution : Copy ,
0 commit comments