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
|
@ -49,11 +49,22 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
inferred_ty: ty,
|
||||
})
|
||||
});
|
||||
|
||||
let literal = ConstantKind::Val(ConstValue::Scalar(Scalar::Int(lit)), ty);
|
||||
|
||||
Constant { span, user_ty: user_ty, literal }
|
||||
}
|
||||
ExprKind::ZstLiteral { user_ty } => {
|
||||
let user_ty = user_ty.map(|user_ty| {
|
||||
this.canonical_user_type_annotations.push(CanonicalUserTypeAnnotation {
|
||||
span,
|
||||
user_ty,
|
||||
inferred_ty: ty,
|
||||
})
|
||||
});
|
||||
let literal = ConstantKind::Val(ConstValue::ZST, ty);
|
||||
|
||||
Constant { span, user_ty: user_ty, literal }
|
||||
}
|
||||
ExprKind::NamedConst { def_id, substs, user_ty } => {
|
||||
let user_ty = user_ty.map(|user_ty| {
|
||||
this.canonical_user_type_annotations.push(CanonicalUserTypeAnnotation {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue