Enum size includes sizes of variants that can't be created #69028
Labels
A-codegen
Area: Code generation
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I tried this code:
I expected
size
test to pass because there is only one value of typeMyPhantomData<i32>
(MyPhantomData::Always
). However, it fails because the actual size ofMyPhantomData<i32>
is8
. It's also notable thatMyPhantomData<()>
is actually ZST.This concrete example may seem strange, but this could also appear in generic code like that:
I'm wondering if there are already issues like that? I couldn't find any...
Meta
Rust playground (stable
1.41.0
/nightly2020-02-09 71c7e149e42cb0fc78a8
)The text was updated successfully, but these errors were encountered: