@@ -37,7 +37,7 @@ use rustc_middle::traits::ObligationCause;
37
37
use rustc_middle:: ty:: error:: { ExpectedFound , TypeError } ;
38
38
use rustc_middle:: ty:: relate:: { self , Relate , RelateResult , TypeRelation } ;
39
39
use rustc_middle:: ty:: subst:: SubstsRef ;
40
- use rustc_middle:: ty:: { self , InferConst , ToPredicate , Ty , TyCtxt , TypeVisitable } ;
40
+ use rustc_middle:: ty:: { self , ToPredicate , Ty , TyCtxt , TypeVisitable } ;
41
41
use rustc_middle:: ty:: { IntType , UintType } ;
42
42
use rustc_span:: { Span , DUMMY_SP } ;
43
43
@@ -143,25 +143,16 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> {
143
143
let a_is_expected = relation. a_is_expected ( ) ;
144
144
145
145
match ( a. kind ( ) , b. kind ( ) ) {
146
- (
147
- ty:: ConstKind :: Infer ( InferConst :: Var ( a_vid) ) ,
148
- ty:: ConstKind :: Infer ( InferConst :: Var ( b_vid) ) ,
149
- ) => {
146
+ ( ty:: ConstKind :: Infer ( a_vid) , ty:: ConstKind :: Infer ( b_vid) ) => {
150
147
self . inner . borrow_mut ( ) . const_unification_table ( ) . union ( a_vid, b_vid) ;
151
148
return Ok ( a) ;
152
149
}
153
150
154
- // All other cases of inference with other variables are errors.
155
- ( ty:: ConstKind :: Infer ( InferConst :: Var ( _) ) , ty:: ConstKind :: Infer ( _) )
156
- | ( ty:: ConstKind :: Infer ( _) , ty:: ConstKind :: Infer ( InferConst :: Var ( _) ) ) => {
157
- bug ! ( "tried to combine ConstKind::Infer/ConstKind::Infer(InferConst::Var)" )
158
- }
159
-
160
- ( ty:: ConstKind :: Infer ( InferConst :: Var ( vid) ) , _) => {
151
+ ( ty:: ConstKind :: Infer ( vid) , _) => {
161
152
return self . unify_const_variable ( relation. param_env ( ) , vid, b, a_is_expected) ;
162
153
}
163
154
164
- ( _, ty:: ConstKind :: Infer ( InferConst :: Var ( vid) ) ) => {
155
+ ( _, ty:: ConstKind :: Infer ( vid) ) => {
165
156
return self . unify_const_variable ( relation. param_env ( ) , vid, a, !a_is_expected) ;
166
157
}
167
158
( ty:: ConstKind :: Unevaluated ( ..) , _) if self . tcx . lazy_normalization ( ) => {
@@ -712,7 +703,7 @@ impl<'tcx> TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
712
703
assert_eq ! ( c, c2) ; // we are abusing TypeRelation here; both LHS and RHS ought to be ==
713
704
714
705
match c. kind ( ) {
715
- ty:: ConstKind :: Infer ( InferConst :: Var ( vid) ) => {
706
+ ty:: ConstKind :: Infer ( vid) => {
716
707
let mut inner = self . infcx . inner . borrow_mut ( ) ;
717
708
let variable_table = & mut inner. const_unification_table ( ) ;
718
709
let var_value = variable_table. probe_value ( vid) ;
@@ -729,7 +720,7 @@ impl<'tcx> TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
729
720
origin : var_value. origin ,
730
721
val : ConstVariableValue :: Unknown { universe : self . for_universe } ,
731
722
} ) ;
732
- Ok ( self . tcx ( ) . mk_const_var ( new_var_id, c. ty ( ) ) )
723
+ Ok ( self . tcx ( ) . mk_const_infer ( new_var_id, c. ty ( ) ) )
733
724
}
734
725
}
735
726
}
@@ -909,7 +900,7 @@ impl<'tcx> TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> {
909
900
debug_assert_eq ! ( c, _c) ;
910
901
911
902
match c. kind ( ) {
912
- ty:: ConstKind :: Infer ( InferConst :: Var ( vid) ) => {
903
+ ty:: ConstKind :: Infer ( vid) => {
913
904
// Check if the current unification would end up
914
905
// unifying `target_vid` with a const which contains
915
906
// an inference variable which is unioned with `target_vid`.
@@ -942,7 +933,7 @@ impl<'tcx> TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> {
942
933
} ,
943
934
} ,
944
935
) ;
945
- Ok ( self . tcx ( ) . mk_const_var ( new_var_id, c. ty ( ) ) )
936
+ Ok ( self . tcx ( ) . mk_const_infer ( new_var_id, c. ty ( ) ) )
946
937
}
947
938
}
948
939
}
0 commit comments