Skip to content

Commit 3386530

Browse files
committed
Streamline next_*_var* methods.
Inline and remove `next_const_var_id`, `next_int_var_id`, `next_float_var_id`, all of which have a single call site.
1 parent deeb0c5 commit 3386530

File tree

1 file changed

+6
-18
lines changed
  • compiler/rustc_infer/src/infer

1 file changed

+6
-18
lines changed

compiler/rustc_infer/src/infer/mod.rs

+6-18
Original file line numberDiff line numberDiff line change
@@ -892,28 +892,16 @@ impl<'tcx> InferCtxt<'tcx> {
892892
ty::Const::new_var(self.tcx, vid)
893893
}
894894

895-
pub fn next_const_var_id(&self, origin: ConstVariableOrigin) -> ConstVid {
896-
self.inner
897-
.borrow_mut()
898-
.const_unification_table()
899-
.new_key(ConstVariableValue::Unknown { origin, universe: self.universe() })
900-
.vid
901-
}
902-
903-
fn next_int_var_id(&self) -> IntVid {
904-
self.inner.borrow_mut().int_unification_table().new_key(ty::IntVarValue::Unknown)
905-
}
906-
907895
pub fn next_int_var(&self) -> Ty<'tcx> {
908-
Ty::new_int_var(self.tcx, self.next_int_var_id())
909-
}
910-
911-
fn next_float_var_id(&self) -> FloatVid {
912-
self.inner.borrow_mut().float_unification_table().new_key(ty::FloatVarValue::Unknown)
896+
let next_int_var_id =
897+
self.inner.borrow_mut().int_unification_table().new_key(ty::IntVarValue::Unknown);
898+
Ty::new_int_var(self.tcx, next_int_var_id)
913899
}
914900

915901
pub fn next_float_var(&self) -> Ty<'tcx> {
916-
Ty::new_float_var(self.tcx, self.next_float_var_id())
902+
let next_float_var_id =
903+
self.inner.borrow_mut().float_unification_table().new_key(ty::FloatVarValue::Unknown);
904+
Ty::new_float_var(self.tcx, next_float_var_id)
917905
}
918906

919907
/// Creates a fresh region variable with the next available index.

0 commit comments

Comments
 (0)