don't allow ZST in ScalarInt
There are several indications that we should not ZST as a ScalarInt: - We had two ways to have ZST valtrees, either an empty `Branch` or a `Leaf` with a ZST in it. `ValTree::zst()` used the former, but the latter could possibly arise as well. - Likewise, the interpreter had `Immediate::Uninit` and `Immediate::Scalar(Scalar::ZST)`. - LLVM codegen already had to special-case ZST ScalarInt. So instead add new ZST variants to those types that did not have other variants which could be used for this purpose.
This commit is contained in:
parent
c4693bc946
commit
a422b42159
21 changed files with 78 additions and 61 deletions
|
@ -1711,7 +1711,7 @@ impl<'tcx> Operand<'tcx> {
|
|||
Operand::Constant(Box::new(Constant {
|
||||
span,
|
||||
user_ty: None,
|
||||
literal: ConstantKind::Val(ConstValue::zst(), ty),
|
||||
literal: ConstantKind::Val(ConstValue::ZST, ty),
|
||||
}))
|
||||
}
|
||||
|
||||
|
@ -2196,7 +2196,7 @@ impl<'tcx> ConstantKind<'tcx> {
|
|||
|
||||
#[inline]
|
||||
pub fn zero_sized(ty: Ty<'tcx>) -> Self {
|
||||
let cv = ConstValue::Scalar(Scalar::ZST);
|
||||
let cv = ConstValue::ZST;
|
||||
Self::Val(cv, ty)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue