]> git.lizzy.rs Git - rust.git/commitdiff
Remove `Const::from_scalar_int`
authorMaybe Waffle <waffle.lapkin@gmail.com>
Mon, 28 Nov 2022 18:04:29 +0000 (18:04 +0000)
committerMaybe Waffle <waffle.lapkin@gmail.com>
Mon, 28 Nov 2022 18:04:29 +0000 (18:04 +0000)
compiler/rustc_middle/src/ty/consts.rs

index eaeb08c7aed403d837e4e850567e088d0c82d6c9..c2be08e497e5bf85bc9174c7a05daf806eb91b51 100644 (file)
@@ -148,11 +148,6 @@ pub fn to_valtree(self) -> ty::ValTree<'tcx> {
         }
     }
 
-    pub fn from_scalar_int(tcx: TyCtxt<'tcx>, i: ScalarInt, ty: Ty<'tcx>) -> Self {
-        let valtree = ty::ValTree::from_scalar_int(i);
-        tcx.mk_const(valtree, ty)
-    }
-
     #[inline]
     /// Creates a constant with the given integer value and interns it.
     pub fn from_bits(tcx: TyCtxt<'tcx>, bits: u128, ty: ParamEnvAnd<'tcx, Ty<'tcx>>) -> Self {
@@ -160,7 +155,10 @@ pub fn from_bits(tcx: TyCtxt<'tcx>, bits: u128, ty: ParamEnvAnd<'tcx, Ty<'tcx>>)
             .layout_of(ty)
             .unwrap_or_else(|e| panic!("could not compute layout for {:?}: {:?}", ty, e))
             .size;
-        Self::from_scalar_int(tcx, ScalarInt::try_from_uint(bits, size).unwrap(), ty.value)
+        tcx.mk_const(
+            ty::ValTree::from_scalar_int(ScalarInt::try_from_uint(bits, size).unwrap()),
+            ty.value,
+        )
     }
 
     #[inline]