You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One hurdle to this that I see is that SSA won't see that VariantC is a bool rather than a Field. I can't point to anything in particular that will break but I'm sure that something will (or be very suboptimal)
@TomAFrench yeah, I'd be worried about potentially "violating" type information there too. It could probably still work with some additional handling though, e.g. dynamically constraining to a bool then casting where appropriate where cast is just a no-op.
If that proves difficult we could start with a lesser version of this and only combine identical types. Or we could delegate to the user-directed #[repr(..)] approach mentioned in the original enum issue.
Problem
An enum such as:
Is currently approximately represented as:
While the optimal representation, without knowing anything else about the usage of the type, is the following:
Happy Case
Represent enums by approximately:
Where a slice
[Field]
is used instead of an array when any of the enum's variants include a slice or other unsized type.Workaround
Yes
Workaround Description
Define this kind of
enum
manually, as a struct, without using any of theenum
features, e.g.match
.Additional Context
No response
Project Impact
Nice-to-have
Blocker Context
No response
Would you like to submit a PR for this Issue?
None
Support Needs
No response
The text was updated successfully, but these errors were encountered: