-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-codegenArea: Code generationArea: Code generationC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team
Description
enum Foo { Foo }
std::mem::size_of::<Foo>() // evaluates to 1
Since type Foo
has only one value, it could have size zero. (This is already the case for single-valued struct types like struct Foo;
.)
Open question: If this change is made, should Foo as uint
still evaluate to 0
in the example above?
Note: It would still be possible to force a non-zero size using [#repr(...)]
or enum Foo { Foo = 1 }
.
nagisa, durka, aturon, strega-nil, Ericson2314 and 4 more
Metadata
Metadata
Assignees
Labels
A-codegenArea: Code generationArea: Code generationC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team