Skip to content

Conversation

@joshlf
Copy link
Contributor

@joshlf joshlf commented Dec 30, 2025

AFAICT, this behavior is widely assumed, and is the intended behavior. repr(C) unions are designed to match the behavior of C unions, and per the C standard:

The size of a union is sufficient to contain the
largest of its members. The value of at most one of the
members can be stored in a union object at any time. A
pointer to a union object, suitably converted, points
to each of its members (or if a member is a bit- field,
then to the unit in which it resides), and vice versa.

Makes progress on rust-lang/unsafe-code-guidelines#595

@rustbot rustbot added the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Dec 30, 2025
@joshlf
Copy link
Contributor Author

joshlf commented Dec 30, 2025

r? t-lang

(Is that valid r? syntax?)

@rustbot rustbot added the T-lang Relevant to the language team. label Dec 30, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 30, 2025

Failed to set assignee to syntax: invalid assignee

Note: Only org members with at least the repository "read" role, users with write permissions, or people who have commented on the PR may be assigned.

@RalfJung
Copy link
Member

I'm surprised we don't already document this.^^

Copy link
Member

@scottmcm scottmcm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH I think this is so settled that we can just merge it without even an FCP, but cc @rust-lang/lang in case anyone has objections to that.

(It's hard to even argue that it's useful to allow differently even for repr(Rust), so for repr(C) I see absolutely no reason we'd even consider something different.)

@traviscross traviscross added I-lang-nominated Nominated for discussion during a lang team meeting. P-lang-drag-1 Lang team prioritization drag level 1. labels Dec 30, 2025
@traviscross
Copy link
Contributor

traviscross commented Dec 30, 2025

Agreed with @scottmcm it seems well settled, and I'm tempted to merge it too, but from a Reference maintainer point-of-view, it's a bit more straightforward to follow the program and lang FCP new (-ly-documented) language guarantees of this kind.

@rfcbot fcp merge lang

(I'll check @scottmcm's box.)

@rust-rfcbot
Copy link
Collaborator

rust-rfcbot commented Dec 30, 2025

Team member @traviscross has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns.
See this document for info about what commands tagged team members can give me.

@traviscross traviscross removed the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Dec 30, 2025
@tmandry
Copy link
Member

tmandry commented Jan 21, 2026

If this weren't true we'd be in trouble :)

@rfcbot reviewed

@rust-rfcbot
Copy link
Collaborator

🔔 This is now entering its final comment period, as per the review above. 🔔

@traviscross traviscross added I-lang-radar Items that are on lang's radar and will need eventual work or consideration. and removed I-lang-nominated Nominated for discussion during a lang team meeting. P-lang-drag-1 Lang team prioritization drag level 1. S-waiting-on-team Status: This is waiting for action from some team. labels Jan 21, 2026
@traviscross traviscross assigned traviscross and unassigned scottmcm Jan 21, 2026
@rustbot

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. label Jan 27, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 27, 2026

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

disposition-merge final-comment-period I-lang-radar Items that are on lang's radar and will need eventual work or consideration. S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. S-waiting-on-fcp T-lang Relevant to the language team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants