1
Fork 0

Replace Scalar::zst with a Scalar::ZST constant

This commit is contained in:
oli 2020-11-01 17:04:13 +00:00
parent b8751c1fbb
commit 8282d526e0
5 changed files with 7 additions and 10 deletions

View file

@ -178,10 +178,7 @@ impl<'tcx, Tag> Scalar<Tag> {
Scalar::Int(ScalarInt::null(cx.data_layout().pointer_size))
}
#[inline]
pub fn zst() -> Self {
Scalar::Int(ScalarInt::ZST)
}
pub const ZST: Self = Scalar::Int(ScalarInt::ZST);
#[inline(always)]
fn ptr_op(

View file

@ -132,7 +132,7 @@ impl<'tcx> Const<'tcx> {
#[inline]
/// Creates an interned zst constant.
pub fn zero_sized(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> &'tcx Self {
Self::from_scalar(tcx, Scalar::zst(), ty)
Self::from_scalar(tcx, Scalar::ZST, ty)
}
#[inline]

View file

@ -844,7 +844,7 @@ impl<'tcx> CommonConsts<'tcx> {
CommonConsts {
unit: mk_const(ty::Const {
val: ty::ConstKind::Value(ConstValue::Scalar(Scalar::zst())),
val: ty::ConstKind::Value(ConstValue::Scalar(Scalar::ZST)),
ty: types.unit,
}),
}