@@ -147,11 +147,7 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> {
147
147
ty:: ConstKind :: Infer ( InferConst :: Var ( a_vid) ) ,
148
148
ty:: ConstKind :: Infer ( InferConst :: Var ( b_vid) ) ,
149
149
) => {
150
- self . inner
151
- . borrow_mut ( )
152
- . const_unification_table ( )
153
- . unify_var_var ( a_vid, b_vid)
154
- . map_err ( |e| const_unification_error ( a_is_expected, e) ) ?;
150
+ self . inner . borrow_mut ( ) . const_unification_table ( ) . union ( a_vid, b_vid) ;
155
151
return Ok ( a) ;
156
152
}
157
153
@@ -246,21 +242,17 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> {
246
242
let value = ConstInferUnifier { infcx : self , span, param_env, for_universe, target_vid }
247
243
. relate ( ct, ct) ?;
248
244
249
- self . inner
250
- . borrow_mut ( )
251
- . const_unification_table ( )
252
- . unify_var_value (
253
- target_vid,
254
- ConstVarValue {
255
- origin : ConstVariableOrigin {
256
- kind : ConstVariableOriginKind :: ConstInference ,
257
- span : DUMMY_SP ,
258
- } ,
259
- val : ConstVariableValue :: Known { value } ,
245
+ self . inner . borrow_mut ( ) . const_unification_table ( ) . union_value (
246
+ target_vid,
247
+ ConstVarValue {
248
+ origin : ConstVariableOrigin {
249
+ kind : ConstVariableOriginKind :: ConstInference ,
250
+ span : DUMMY_SP ,
260
251
} ,
261
- )
262
- . map ( |( ) | value)
263
- . map_err ( |e| const_unification_error ( vid_is_expected, e) )
252
+ val : ConstVariableValue :: Known { value } ,
253
+ } ,
254
+ ) ;
255
+ Ok ( value)
264
256
}
265
257
266
258
fn unify_integral_variable (
@@ -768,13 +760,6 @@ pub trait ConstEquateRelation<'tcx>: TypeRelation<'tcx> {
768
760
fn const_equate_obligation ( & mut self , a : ty:: Const < ' tcx > , b : ty:: Const < ' tcx > ) ;
769
761
}
770
762
771
- pub fn const_unification_error < ' tcx > (
772
- a_is_expected : bool ,
773
- ( a, b) : ( ty:: Const < ' tcx > , ty:: Const < ' tcx > ) ,
774
- ) -> TypeError < ' tcx > {
775
- TypeError :: ConstMismatch ( ExpectedFound :: new ( a_is_expected, a, b) )
776
- }
777
-
778
763
fn int_unification_error < ' tcx > (
779
764
a_is_expected : bool ,
780
765
v : ( ty:: IntVarValue , ty:: IntVarValue ) ,
0 commit comments