Skip to content

Conversation

@Darksonn
Copy link
Member

@Darksonn Darksonn commented Feb 12, 2026

This fixes a bug that we currently say that fields of enums and unions must not overlap.

As mentioned in #2166 (comment) there is currently no exception for uninhabited types. We should determine whether such an exception should be added, but this is a pre-existing problem so let's not block this PR on that.

This PR does not add any statement about overlap for fields of the same variant of an enum because the uninhabited type concern should be addressed first before we say anything about enums.

@rustbot rustbot added the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Feb 12, 2026
@RalfJung
Copy link
Member

LGTM with the nit fixed -- the only change here is fixing what clearly looks like an editorial issue.

Co-authored-by: Ralf Jung <post@ralfj.de>
@RalfJung
Copy link
Member

RalfJung commented Feb 12, 2026

Lol this seems to have been wrong for years (#1152 landed in 2022) and nobody complained in all that time that union fields apparently must be disjoint?^^

@Darksonn Darksonn changed the title Clarify repr(rust) list is about structs only Fields of enums and unions should be allowed to overlap Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: The marked PR is awaiting review from a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants