-
Notifications
You must be signed in to change notification settings - Fork 34
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
Segfault on more than 256 enumerations #83
Comments
Are you using If so, it's normal that it fails since u8 give you 256 discriminant. About the segfault instead of a compilation error, I have no idea. |
@vertexclique Thanks for the bug report - please could you include a sample code snippet that reproduces the problem? I've tried to reproduce a few different ways, and haven't been able to... |
Smaller repr on the larger variants is always compiler error. It's not segfault. I unfortunately can't share the repro code. Only thing is there variants are 0 variadics so literally something like this: enum Data { I wrote 256 because it staggers during compilation. I suspect something else might be going on that I don't know. |
Can you share exactly what attributes you have on the enum? What's its repr? What trait(s) are you deriving? |
#[derive(Debug, Clone, Copy, PartialOrd, Display, PartialEq, Eq, TryFromPrimitive)]
#[repr(u16)]
pub enum Data {
A,
B,
C,
... 900 more
} |
As far as I can tell, this is actually blowing up the stack of rustc (at least that's the only way I could repro this), and #89 should fix it by simplifying the generated code. |
Happens on both nightly and on stable:
cargo 1.66.0 (d65d197ad 2022-11-15)
The text was updated successfully, but these errors were encountered: