Specialize ZeroSized constants
ZeroSized constants can be represented as `mir::Const::Val` even if their layout is not yet known. In those cases, CrateItem::body() was crashing when trying to convert a `ConstValue::ZeroSized` into its stable counterpart `ConstantKind::Allocated`. Instead, we now map `ConstValue::ZeroSized` into a new variant: `ConstantKind::ZeroSized`.
This commit is contained in:
parent
ab5c841a1f
commit
613e6181a6
3 changed files with 18 additions and 6 deletions
|
@ -444,6 +444,9 @@ pub enum ConstantKind {
|
|||
Allocated(Allocation),
|
||||
Unevaluated(UnevaluatedConst),
|
||||
Param(ParamConst),
|
||||
/// Store ZST constants.
|
||||
/// We have to special handle these constants since its type might be generic.
|
||||
ZeroSized,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue