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
I'd expect DataA and DataB to have the same size. I certainly wouldn't expect a simple refactoring that extracts an inline struct into a named one to increase the size of the enum.
My guess as to what's happening here is that rustc isn't smart enough to put the enum discriminant into the InlineData padding bytes.
@Valloric in general, since repr(Rust) ADTs have no specified layouts, there should be no expectations with regards to equivalence between two different (or even two same looking) types.
in general, since repr(Rust) ADTs have no specified layouts, there should be no expectations with regards to equivalence between two different (or even two same looking) types.
Sure, the layout is unspecified, but users still have expectations that what looks like a simple refactor that extracts an unnamed struct into a named one shouldn't increase the size of an enum.
In other words, this particular case doesn't look like a missed optimization to a user; it just looks like a bug.
Output:
Playground link.
I'd expect DataA and DataB to have the same size. I certainly wouldn't expect a simple refactoring that extracts an inline struct into a named one to increase the size of the enum.
My guess as to what's happening here is that rustc isn't smart enough to put the enum discriminant into the
InlineData
padding bytes.cc @jwilm
The text was updated successfully, but these errors were encountered: