@@ -728,6 +728,21 @@ impl<I: Interner> TyKind<I> {
728728 dyn_flags |= alias_eq. alias . compute_flags ( interner) ;
729729 dyn_flags |= alias_eq. ty . data ( interner) . flags ;
730730 }
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+ }
731746 WhereClause :: LifetimeOutlives ( lifetime_outlives) => {
732747 dyn_flags |= lifetime_outlives. a . compute_flags ( interner)
733748 | lifetime_outlives. b . compute_flags ( interner) ;
@@ -1743,13 +1758,16 @@ pub enum WhereClause<I: Interner> {
17431758 LifetimeOutlives ( LifetimeOutlives < I > ) ,
17441759 /// Type outlives a lifetime.
17451760 TypeOutlives ( TypeOutlives < I > ) ,
1761+ /// Const is equal to another const
1762+ ConstEq ( ConstEq < I > ) ,
17461763}
17471764
17481765impl < I : Interner > Copy for WhereClause < I >
17491766where
17501767 I :: InternedSubstitution : Copy ,
17511768 I :: InternedLifetime : Copy ,
17521769 I :: InternedType : Copy ,
1770+ I :: InternedConst : Copy ,
17531771{
17541772}
17551773
@@ -1908,6 +1926,7 @@ where
19081926 I :: InternedSubstitution : Copy ,
19091927 I :: InternedLifetime : Copy ,
19101928 I :: InternedType : Copy ,
1929+ I :: InternedConst : Copy ,
19111930{
19121931}
19131932
@@ -1939,6 +1958,7 @@ impl<I: Interner> WhereClause<I> {
19391958 match self {
19401959 WhereClause :: Implemented ( trait_ref) => Some ( trait_ref. trait_id ) ,
19411960 WhereClause :: AliasEq ( _) => None ,
1961+ WhereClause :: ConstEq ( _) => None ,
19421962 WhereClause :: LifetimeOutlives ( _) => None ,
19431963 WhereClause :: TypeOutlives ( _) => None ,
19441964 }
@@ -2046,6 +2066,26 @@ impl<I: Interner> HasInterner for AliasEq<I> {
20462066 type Interner = I ;
20472067}
20482068
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+
20492089/// Indicates that the `value` is universally quantified over `N`
20502090/// parameters of the given kinds, where `N == self.binders.len()`. A
20512091/// variable with depth `i < N` refers to the value at
@@ -2610,6 +2650,7 @@ pub enum GoalData<I: Interner> {
26102650impl < I : Interner > Copy for GoalData < I >
26112651where
26122652 I :: InternedType : Copy ,
2653+ I :: InternedConst : Copy ,
26132654 I :: InternedLifetime : Copy ,
26142655 I :: InternedGenericArg : Copy ,
26152656 I :: InternedSubstitution : Copy ,
0 commit comments