Skip to content

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

Merged
merged 1 commit into from
Nov 22, 2015
Merged

Conversation

Manishearth
Copy link
Member

r? @gankro

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.
Copy link
Contributor

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/

type Foo = u8;

#[repr(packed)]
enum Foo {Bar, Baz}
Copy link
Contributor

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.

Copy link
Member Author

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?

Copy link
Contributor

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 } }

@Manishearth Manishearth force-pushed the repr-error branch 2 times, most recently from 9f25ce9 to c03048f Compare November 11, 2015 18:17
@Manishearth
Copy link
Member Author

Updated.

@Gankra
Copy link
Contributor

Gankra commented Nov 22, 2015

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 22, 2015

📌 Commit 92df8a9 has been approved by Gankro

@Manishearth
Copy link
Member Author

@bors rollup

bors added a commit that referenced this pull request Nov 22, 2015
@bors
Copy link
Collaborator

bors commented Nov 22, 2015

⌛ Testing commit 92df8a9 with merge e24fffe...

@bors bors merged commit 92df8a9 into rust-lang:master Nov 22, 2015
@Manishearth Manishearth deleted the repr-error branch December 2, 2016 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants