@@ -989,12 +989,9 @@ impl<'tcx> InferCtxt<'tcx> {
989
989
self . inner . borrow_mut ( ) . type_variables ( ) . num_vars ( )
990
990
}
991
991
992
- pub fn next_ty_var_id ( & self , origin : TypeVariableOrigin ) -> TyVid {
993
- self . inner . borrow_mut ( ) . type_variables ( ) . new_var ( self . universe ( ) , origin)
994
- }
995
-
996
992
pub fn next_ty_var ( & self , origin : TypeVariableOrigin ) -> Ty < ' tcx > {
997
- Ty :: new_var ( self . tcx , self . next_ty_var_id ( origin) )
993
+ let vid = self . inner . borrow_mut ( ) . type_variables ( ) . new_var ( self . universe ( ) , origin) ;
994
+ Ty :: new_var ( self . tcx , vid)
998
995
}
999
996
1000
997
pub fn next_ty_var_id_in_universe (
@@ -1015,7 +1012,13 @@ impl<'tcx> InferCtxt<'tcx> {
1015
1012
}
1016
1013
1017
1014
pub fn next_const_var ( & self , ty : Ty < ' tcx > , origin : ConstVariableOrigin ) -> ty:: Const < ' tcx > {
1018
- ty:: Const :: new_var ( self . tcx , self . next_const_var_id ( origin) , ty)
1015
+ let vid = self
1016
+ . inner
1017
+ . borrow_mut ( )
1018
+ . const_unification_table ( )
1019
+ . new_key ( ConstVariableValue :: Unknown { origin, universe : self . universe ( ) } )
1020
+ . vid ;
1021
+ ty:: Const :: new_var ( self . tcx , vid, ty)
1019
1022
}
1020
1023
1021
1024
pub fn next_const_var_in_universe (
@@ -1033,28 +1036,14 @@ impl<'tcx> InferCtxt<'tcx> {
1033
1036
ty:: Const :: new_var ( self . tcx , vid, ty)
1034
1037
}
1035
1038
1036
- pub fn next_const_var_id ( & self , origin : ConstVariableOrigin ) -> ConstVid {
1037
- self . inner
1038
- . borrow_mut ( )
1039
- . const_unification_table ( )
1040
- . new_key ( ConstVariableValue :: Unknown { origin, universe : self . universe ( ) } )
1041
- . vid
1042
- }
1043
-
1044
- fn next_int_var_id ( & self ) -> IntVid {
1045
- self . inner . borrow_mut ( ) . int_unification_table ( ) . new_key ( None )
1046
- }
1047
-
1048
1039
pub fn next_int_var ( & self ) -> Ty < ' tcx > {
1049
- Ty :: new_int_var ( self . tcx , self . next_int_var_id ( ) )
1050
- }
1051
-
1052
- fn next_float_var_id ( & self ) -> FloatVid {
1053
- self . inner . borrow_mut ( ) . float_unification_table ( ) . new_key ( None )
1040
+ let vid = self . inner . borrow_mut ( ) . int_unification_table ( ) . new_key ( None ) ;
1041
+ Ty :: new_int_var ( self . tcx , vid)
1054
1042
}
1055
1043
1056
1044
pub fn next_float_var ( & self ) -> Ty < ' tcx > {
1057
- Ty :: new_float_var ( self . tcx , self . next_float_var_id ( ) )
1045
+ let vid = self . inner . borrow_mut ( ) . float_unification_table ( ) . new_key ( None ) ;
1046
+ Ty :: new_float_var ( self . tcx , vid)
1058
1047
}
1059
1048
1060
1049
/// Creates a fresh region variable with the next available index.
0 commit comments