Skip to content
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

Contiguous should be derivable for enums when only the first discriminant is an expression #266

Open
ds84182 opened this issue Aug 22, 2024 · 1 comment
Labels
proc-macros I don't do proc-macros, but I accepts PRs about them.

Comments

@ds84182
Copy link

ds84182 commented Aug 22, 2024

This is currently rejected because it isn't an integer literal.

Example:

const MY_CONST: u8 = 123;
#[derive(Copy, Clone, bytemuck::Contiguous)]
#[repr(u8)]
enum Foo {
    A = MY_CONST,
    B,
    C,
}
@Lokathor
Copy link
Owner

Yes, this sounds right.

As usual for proc-macros, I'm not interested in doing this myself, but if someone else submits the PR then we can get it handled and published.

@Lokathor Lokathor added the proc-macros I don't do proc-macros, but I accepts PRs about them. label Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proc-macros I don't do proc-macros, but I accepts PRs about them.
Projects
None yet
Development

No branches or pull requests

2 participants