@@ -147,11 +147,7 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> {
147147 ty:: ConstKind :: Infer ( InferConst :: Var ( a_vid) ) ,
148148 ty:: ConstKind :: Infer ( InferConst :: Var ( b_vid) ) ,
149149 ) => {
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) ;
155151 return Ok ( a) ;
156152 }
157153
@@ -246,21 +242,17 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> {
246242 let value = ConstInferUnifier { infcx : self , span, param_env, for_universe, target_vid }
247243 . relate ( ct, ct) ?;
248244
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 ,
260251 } ,
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)
264256 }
265257
266258 fn unify_integral_variable (
@@ -768,13 +760,6 @@ pub trait ConstEquateRelation<'tcx>: TypeRelation<'tcx> {
768760 fn const_equate_obligation ( & mut self , a : ty:: Const < ' tcx > , b : ty:: Const < ' tcx > ) ;
769761}
770762
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-
778763fn int_unification_error < ' tcx > (
779764 a_is_expected : bool ,
780765 v : ( ty:: IntVarValue , ty:: IntVarValue ) ,
0 commit comments