@@ -728,6 +728,21 @@ 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 | match const_data. value {
737
+ ConstValue :: BoundVar ( _) | ConstValue :: Concrete ( _) => TypeFlags :: empty ( ) ,
738
+ ConstValue :: InferenceVar ( _) => {
739
+ TypeFlags :: HAS_CT_INFER | TypeFlags :: STILL_FURTHER_SPECIALIZABLE
740
+ }
741
+ ConstValue :: Placeholder ( _) => {
742
+ TypeFlags :: HAS_CT_PLACEHOLDER | TypeFlags :: STILL_FURTHER_SPECIALIZABLE
743
+ }
744
+ }
745
+ }
731
746
WhereClause :: LifetimeOutlives ( lifetime_outlives) => {
732
747
dyn_flags |= lifetime_outlives. a . compute_flags ( interner)
733
748
| lifetime_outlives. b . compute_flags ( interner) ;
@@ -1743,13 +1758,16 @@ pub enum WhereClause<I: Interner> {
1743
1758
LifetimeOutlives ( LifetimeOutlives < I > ) ,
1744
1759
/// Type outlives a lifetime.
1745
1760
TypeOutlives ( TypeOutlives < I > ) ,
1761
+ /// Const is equal to another const
1762
+ ConstEq ( ConstEq < I > ) ,
1746
1763
}
1747
1764
1748
1765
impl < I : Interner > Copy for WhereClause < I >
1749
1766
where
1750
1767
I :: InternedSubstitution : Copy ,
1751
1768
I :: InternedLifetime : Copy ,
1752
1769
I :: InternedType : Copy ,
1770
+ I :: InternedConst : Copy ,
1753
1771
{
1754
1772
}
1755
1773
@@ -1908,6 +1926,7 @@ where
1908
1926
I :: InternedSubstitution : Copy ,
1909
1927
I :: InternedLifetime : Copy ,
1910
1928
I :: InternedType : Copy ,
1929
+ I :: InternedConst : Copy ,
1911
1930
{
1912
1931
}
1913
1932
@@ -1939,6 +1958,7 @@ impl<I: Interner> WhereClause<I> {
1939
1958
match self {
1940
1959
WhereClause :: Implemented ( trait_ref) => Some ( trait_ref. trait_id ) ,
1941
1960
WhereClause :: AliasEq ( _) => None ,
1961
+ WhereClause :: ConstEq ( _) => None ,
1942
1962
WhereClause :: LifetimeOutlives ( _) => None ,
1943
1963
WhereClause :: TypeOutlives ( _) => None ,
1944
1964
}
@@ -2046,6 +2066,26 @@ impl<I: Interner> HasInterner for AliasEq<I> {
2046
2066
type Interner = I ;
2047
2067
}
2048
2068
2069
+ /// Proves **equality** between an alias and a type.
2070
+ #[ derive( Clone , PartialEq , Eq , Hash , Fold , Visit , Zip ) ]
2071
+ #[ allow( missing_docs) ]
2072
+ pub struct ConstEq < I : Interner > {
2073
+ /// The id for the associated type member.
2074
+ pub term : AssocItemId < I > ,
2075
+
2076
+ pub ct : Const < I > ,
2077
+ }
2078
+ impl < I : Interner > Copy for ConstEq < I >
2079
+ where
2080
+ I :: InternedSubstitution : Copy ,
2081
+ I :: InternedConst : Copy ,
2082
+ {
2083
+ }
2084
+
2085
+ impl < I : Interner > HasInterner for ConstEq < I > {
2086
+ type Interner = I ;
2087
+ }
2088
+
2049
2089
/// Indicates that the `value` is universally quantified over `N`
2050
2090
/// parameters of the given kinds, where `N == self.binders.len()`. A
2051
2091
/// variable with depth `i < N` refers to the value at
@@ -2610,6 +2650,7 @@ pub enum GoalData<I: Interner> {
2610
2650
impl < I : Interner > Copy for GoalData < I >
2611
2651
where
2612
2652
I :: InternedType : Copy ,
2653
+ I :: InternedConst : Copy ,
2613
2654
I :: InternedLifetime : Copy ,
2614
2655
I :: InternedGenericArg : Copy ,
2615
2656
I :: InternedSubstitution : Copy ,
0 commit comments