nail down the final validity rules: references and unions - #2337
Open
RalfJung wants to merge 2 commits into
Open
nail down the final validity rules: references and unions#2337RalfJung wants to merge 2 commits into
RalfJung wants to merge 2 commits into
Conversation
Member
Author
|
@rustbot label +I-lang-nominated |
RalfJung
force-pushed
the
finish-validity
branch
from
August 23, 2026 21:30
75ee1eb to
caf7145
Compare
RalfJung
force-pushed
the
finish-validity
branch
from
August 23, 2026 21:32
caf7145 to
93d25cc
Compare
Member
Author
|
A proposal came up in rust-lang/unsafe-code-guidelines#620 to slightly strengthen the requirements for references / @scottmcm do you have suggestions for how that should be worded? |
RalfJung
commented
Aug 24, 2026
Comment on lines
+155
to
+156
| For unsized types, this check considers dynamic information from the metadata: | ||
| If `T` has an unsized tail of slice type (`[U]`), it is inhabited of the length encoded in the metadata is 0 or if `U` is inhabited. |
Member
Author
There was a problem hiding this comment.
These two lines are for rust-lang/unsafe-code-guidelines#620. We didn't explicitly discuss this case in the opsem FCP.
RalfJung
force-pushed
the
finish-validity
branch
from
August 24, 2026 09:26
5dcbf41 to
a094ac6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This translates the following t-opsem FCPs into Reference text:
Cc @rust-lang/opsem
@rust-lang/lang you have not FCP'd this yet; please let us know if you want this to go through your own decision process as well.
Fixes rust-lang/unsafe-code-guidelines#413
Fixes rust-lang/unsafe-code-guidelines#414
Fixes rust-lang/unsafe-code-guidelines#438