diff options
| author | Maybe Waffle <waffle.lapkin@gmail.com> | 2022-11-28 18:04:29 +0000 |
|---|---|---|
| committer | Maybe Waffle <waffle.lapkin@gmail.com> | 2022-11-28 18:04:29 +0000 |
| commit | a44eb3c3662b39ca715c8d7bedbc45c18579779e (patch) | |
| tree | f72258c186a9381f3504c117267d4bc035ac70e3 /compiler | |
| parent | b44817f95eeed6c80cc8a4477a456b3d567ce22c (diff) | |
| download | rust-a44eb3c3662b39ca715c8d7bedbc45c18579779e.tar.gz rust-a44eb3c3662b39ca715c8d7bedbc45c18579779e.zip | |
Remove `Const::from_scalar_int`
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_middle/src/ty/consts.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/compiler/rustc_middle/src/ty/consts.rs b/compiler/rustc_middle/src/ty/consts.rs index eaeb08c7aed..c2be08e497e 100644 --- a/compiler/rustc_middle/src/ty/consts.rs +++ b/compiler/rustc_middle/src/ty/consts.rs @@ -148,11 +148,6 @@ impl<'tcx> Const<'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 @@ impl<'tcx> Const<'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] |
