1- use super :: combine:: { CombineFields , RelationDir } ;
1+ use super :: combine:: { CombineFields , RelationDir , ConstEquateRelation } ;
22use super :: Subtype ;
33
44use rustc_middle:: ty:: relate:: { self , Relate , RelateResult , TypeRelation } ;
55use rustc_middle:: ty:: subst:: SubstsRef ;
66use rustc_middle:: ty:: TyVar ;
7- use rustc_middle:: ty:: { self , ConstKind , Ty , TyCtxt } ;
7+ use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
88
99use rustc_hir:: def_id:: DefId ;
1010
@@ -119,17 +119,7 @@ impl TypeRelation<'tcx> for Equate<'combine, 'infcx, 'tcx> {
119119 a : & ' tcx ty:: Const < ' tcx > ,
120120 b : & ' tcx ty:: Const < ' tcx > ,
121121 ) -> 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)
133123 }
134124
135125 fn binders < T > (
@@ -150,3 +140,9 @@ impl TypeRelation<'tcx> for Equate<'combine, 'infcx, 'tcx> {
150140 }
151141 }
152142}
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