@@ -866,6 +866,7 @@ impl TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> {
866866 Ok ( a. rebind ( self . relate ( a. skip_binder ( ) , b. skip_binder ( ) ) ?) )
867867 }
868868
869+ #[ tracing:: instrument( level = "debug" , skip( self ) ) ]
869870 fn tys ( & mut self , t : Ty < ' tcx > , _t : Ty < ' tcx > ) -> RelateResult < ' tcx , Ty < ' tcx > > {
870871 debug_assert_eq ! ( t, _t) ;
871872 debug ! ( "ConstInferUnifier: t={:?}" , t) ;
@@ -941,6 +942,7 @@ impl TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> {
941942 }
942943 }
943944
945+ #[ tracing:: instrument( level = "debug" , skip( self ) ) ]
944946 fn consts (
945947 & mut self ,
946948 c : & ' tcx ty:: Const < ' tcx > ,
@@ -951,29 +953,38 @@ impl TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> {
951953
952954 match c. val {
953955 ty:: ConstKind :: Infer ( InferConst :: Var ( vid) ) => {
954- let mut inner = self . infcx . inner . borrow_mut ( ) ;
955- let variable_table = & mut inner. const_unification_table ( ) ;
956-
957956 // Check if the current unification would end up
958957 // unifying `target_vid` with a const which contains
959958 // an inference variable which is unioned with `target_vid`.
960959 //
961960 // Not doing so can easily result in stack overflows.
962- if variable_table. unioned ( self . target_vid , vid) {
961+ if self
962+ . infcx
963+ . inner
964+ . borrow_mut ( )
965+ . const_unification_table ( )
966+ . unioned ( self . target_vid , vid)
967+ {
963968 return Err ( TypeError :: CyclicConst ( c) ) ;
964969 }
965970
966- let var_value = variable_table. probe_value ( vid) ;
971+ let var_value =
972+ self . infcx . inner . borrow_mut ( ) . const_unification_table ( ) . probe_value ( vid) ;
967973 match var_value. val {
968974 ConstVariableValue :: Known { value : u } => self . consts ( u, u) ,
969975 ConstVariableValue :: Unknown { universe } => {
970976 if self . for_universe . can_name ( universe) {
971977 Ok ( c)
972978 } else {
973- let new_var_id = variable_table. new_key ( ConstVarValue {
974- origin : var_value. origin ,
975- val : ConstVariableValue :: Unknown { universe : self . for_universe } ,
976- } ) ;
979+ let new_var_id =
980+ self . infcx . inner . borrow_mut ( ) . const_unification_table ( ) . new_key (
981+ ConstVarValue {
982+ origin : var_value. origin ,
983+ val : ConstVariableValue :: Unknown {
984+ universe : self . for_universe ,
985+ } ,
986+ } ,
987+ ) ;
977988 Ok ( self . tcx ( ) . mk_const_var ( new_var_id, c. ty ) )
978989 }
979990 }
0 commit comments