Skip to content

Commit a44eb3c

Browse files
committed
Remove Const::from_scalar_int
1 parent b44817f commit a44eb3c

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

compiler/rustc_middle/src/ty/consts.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -148,19 +148,17 @@ impl<'tcx> Const<'tcx> {
148148
}
149149
}
150150

151-
pub fn from_scalar_int(tcx: TyCtxt<'tcx>, i: ScalarInt, ty: Ty<'tcx>) -> Self {
152-
let valtree = ty::ValTree::from_scalar_int(i);
153-
tcx.mk_const(valtree, ty)
154-
}
155-
156151
#[inline]
157152
/// Creates a constant with the given integer value and interns it.
158153
pub fn from_bits(tcx: TyCtxt<'tcx>, bits: u128, ty: ParamEnvAnd<'tcx, Ty<'tcx>>) -> Self {
159154
let size = tcx
160155
.layout_of(ty)
161156
.unwrap_or_else(|e| panic!("could not compute layout for {:?}: {:?}", ty, e))
162157
.size;
163-
Self::from_scalar_int(tcx, ScalarInt::try_from_uint(bits, size).unwrap(), ty.value)
158+
tcx.mk_const(
159+
ty::ValTree::from_scalar_int(ScalarInt::try_from_uint(bits, size).unwrap()),
160+
ty.value,
161+
)
164162
}
165163

166164
#[inline]

0 commit comments

Comments
 (0)