-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add E0517, E0518 for repr() errors #29716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
discriminant size for C-like enums (i.e., no data), effectively setting the | ||
entire size to the same type. Such an enum can be cast to a value of the same | ||
type as well. In short, `#[repr(u8)]` makes the enum behave like an integer with | ||
constrained set of allowed values. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/constrained set/a constrained set/
b016333
to
76d3732
Compare
type Foo = u8; | ||
|
||
#[repr(packed)] | ||
enum Foo {Bar, Baz} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh whoah. Curly brace enums without field names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ enums always have curly braces?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Man, how tired was I?
I though this was enum Foo { Foo { Bar, Baz } }
9f25ce9
to
c03048f
Compare
Updated. |
c03048f
to
92df8a9
Compare
@bors r+ |
📌 Commit 92df8a9 has been approved by |
@bors rollup |
r? @gankro