Skip to content

nail down the final validity rules: references and unions - #2337

Open
RalfJung wants to merge 2 commits into
rust-lang:masterfrom
RalfJung:finish-validity
Open

nail down the final validity rules: references and unions#2337
RalfJung wants to merge 2 commits into
rust-lang:masterfrom
RalfJung:finish-validity

Conversation

@RalfJung

Copy link
Copy Markdown
Member

@rustbot rustbot added the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Aug 23, 2026
@RalfJung

Copy link
Copy Markdown
Member Author

@rustbot label +I-lang-nominated

@rustbot rustbot added the I-lang-nominated Nominated for discussion during a lang team meeting. label Aug 23, 2026
@traviscross traviscross added the I-lang-docs-nominated Nominated for discussion during a lang-docs team meeting. label Aug 24, 2026
@RalfJung

Copy link
Copy Markdown
Member Author

A proposal came up in rust-lang/unsafe-code-guidelines#620 to slightly strengthen the requirements for references / Box to types with a slice tail.

@scottmcm do you have suggestions for how that should be worded?

Comment thread src/behavior-considered-undefined.md Outdated
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.

@RalfJung RalfJung Aug 24, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

These two lines are for rust-lang/unsafe-code-guidelines#620. We didn't explicitly discuss this case in the opsem FCP.

View changes since the review

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

Labels

I-lang-docs-nominated Nominated for discussion during a lang-docs team meeting. I-lang-nominated Nominated for discussion during a lang team meeting. S-waiting-on-review Status: The marked PR is awaiting review from a maintainer

Projects

None yet

3 participants