1
- use super :: combine:: { CombineFields , RelationDir } ;
1
+ use super :: combine:: { CombineFields , RelationDir , ConstEquateRelation } ;
2
2
use super :: Subtype ;
3
3
4
4
use rustc_middle:: ty:: relate:: { self , Relate , RelateResult , TypeRelation } ;
5
5
use rustc_middle:: ty:: subst:: SubstsRef ;
6
6
use rustc_middle:: ty:: TyVar ;
7
- use rustc_middle:: ty:: { self , ConstKind , Ty , TyCtxt } ;
7
+ use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
8
8
9
9
use rustc_hir:: def_id:: DefId ;
10
10
@@ -119,17 +119,7 @@ impl TypeRelation<'tcx> for Equate<'combine, 'infcx, 'tcx> {
119
119
a : & ' tcx ty:: Const < ' tcx > ,
120
120
b : & ' tcx ty:: Const < ' tcx > ,
121
121
) -> RelateResult < ' tcx , & ' tcx ty:: Const < ' tcx > > {
122
- match ( a. val , b. val ) {
123
- ( ConstKind :: Unevaluated ( ..) , _) => {
124
- self . fields . add_const_equate_obligation ( self . a_is_expected , a, b) ;
125
- Ok ( b)
126
- }
127
- ( _, ConstKind :: Unevaluated ( ..) ) => {
128
- self . fields . add_const_equate_obligation ( self . a_is_expected , a, b) ;
129
- Ok ( a)
130
- }
131
- _ => self . fields . infcx . super_combine_consts ( self , a, b) ,
132
- }
122
+ self . fields . infcx . super_combine_consts ( self , a, b)
133
123
}
134
124
135
125
fn binders < T > (
@@ -150,3 +140,9 @@ impl TypeRelation<'tcx> for Equate<'combine, 'infcx, 'tcx> {
150
140
}
151
141
}
152
142
}
143
+
144
+ impl < ' tcx > ConstEquateRelation < ' tcx > for Equate < ' _ , ' _ , ' tcx > {
145
+ fn const_equate_obligation ( & mut self , a : & ' tcx ty:: Const < ' tcx > , b : & ' tcx ty:: Const < ' tcx > ) {
146
+ self . fields . add_const_equate_obligation ( self . a_is_expected , a, b) ;
147
+ }
148
+ }
0 commit comments