@@ -46,7 +46,7 @@ use self::region_constraints::{GenericKind, RegionConstraintData, VarInfos, Veri
4646use self :: region_constraints:: {
4747 RegionConstraintCollector , RegionConstraintStorage , RegionSnapshot ,
4848} ;
49- use self :: type_variable:: { Diverging , TypeVariableOrigin , TypeVariableOriginKind } ;
49+ use self :: type_variable:: { TypeVariableOrigin , TypeVariableOriginKind } ;
5050
5151pub mod at;
5252pub mod canonical;
@@ -702,17 +702,6 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
702702 t. fold_with ( & mut self . freshener ( ) )
703703 }
704704
705- /// Returns whether `ty` is a diverging type variable or not.
706- /// (If `ty` is not a type variable at all, returns not diverging.)
707- ///
708- /// No attempt is made to resolve `ty`.
709- pub fn type_var_diverges ( & ' a self , ty : Ty < ' _ > ) -> Diverging {
710- match * ty. kind ( ) {
711- ty:: Infer ( ty:: TyVar ( vid) ) => self . inner . borrow_mut ( ) . type_variables ( ) . var_diverges ( vid) ,
712- _ => Diverging :: NotDiverging ,
713- }
714- }
715-
716705 /// Returns the origin of the type variable identified by `vid`, or `None`
717706 /// if this is not a type variable.
718707 ///
@@ -1071,31 +1060,28 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
10711060 } )
10721061 }
10731062
1074- pub fn next_ty_var_id ( & self , diverging : Diverging , origin : TypeVariableOrigin ) -> TyVid {
1075- self . inner . borrow_mut ( ) . type_variables ( ) . new_var ( self . universe ( ) , diverging, origin)
1063+ /// Number of type variables created so far.
1064+ pub fn num_ty_vars ( & self ) -> usize {
1065+ self . inner . borrow_mut ( ) . type_variables ( ) . num_vars ( )
1066+ }
1067+
1068+ pub fn next_ty_var_id ( & self , origin : TypeVariableOrigin ) -> TyVid {
1069+ self . inner . borrow_mut ( ) . type_variables ( ) . new_var ( self . universe ( ) , origin)
10761070 }
10771071
10781072 pub fn next_ty_var ( & self , origin : TypeVariableOrigin ) -> Ty < ' tcx > {
1079- self . tcx . mk_ty_var ( self . next_ty_var_id ( Diverging :: NotDiverging , origin) )
1073+ self . tcx . mk_ty_var ( self . next_ty_var_id ( origin) )
10801074 }
10811075
10821076 pub fn next_ty_var_in_universe (
10831077 & self ,
10841078 origin : TypeVariableOrigin ,
10851079 universe : ty:: UniverseIndex ,
10861080 ) -> Ty < ' tcx > {
1087- let vid = self . inner . borrow_mut ( ) . type_variables ( ) . new_var (
1088- universe,
1089- Diverging :: NotDiverging ,
1090- origin,
1091- ) ;
1081+ let vid = self . inner . borrow_mut ( ) . type_variables ( ) . new_var ( universe, origin) ;
10921082 self . tcx . mk_ty_var ( vid)
10931083 }
10941084
1095- pub fn next_diverging_ty_var ( & self , origin : TypeVariableOrigin ) -> Ty < ' tcx > {
1096- self . tcx . mk_ty_var ( self . next_ty_var_id ( Diverging :: Diverges , origin) )
1097- }
1098-
10991085 pub fn next_const_var (
11001086 & self ,
11011087 ty : Ty < ' tcx > ,
@@ -1207,7 +1193,6 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
12071193 // as the substitutions for the default, `(T, U)`.
12081194 let ty_var_id = self . inner . borrow_mut ( ) . type_variables ( ) . new_var (
12091195 self . universe ( ) ,
1210- Diverging :: NotDiverging ,
12111196 TypeVariableOrigin {
12121197 kind : TypeVariableOriginKind :: TypeParameterDefinition (
12131198 param. name ,
0 commit comments