Skip to content

Document which union patterns are unsafe - #2350

Draft
Jules-Bertholet wants to merge 4 commits into
rust-lang:masterfrom
Jules-Bertholet:safe-union-leaf-patterns
Draft

Document which union patterns are unsafe#2350
Jules-Bertholet wants to merge 4 commits into
rust-lang:masterfrom
Jules-Bertholet:safe-union-leaf-patterns

Conversation

@Jules-Bertholet

@Jules-Bertholet Jules-Bertholet commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

@theemathas

Copy link
Copy Markdown
Contributor

I think this kind of definition of what patterns "access" a thing could also be useful for implementing a lint for rust-lang/rust#158387 (comment). cc @Nadrieril

Comment thread src/items/unions.md
Comment thread src/items/unions.md

@dianne dianne Sep 9, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe it'd be worth having an admonition acknowledging slice patterns matching on slices? Not sure on this (maybe it's immediately obvious that they'd need to be under references anyway?), but it feels a bit suspicious that they're not a list of patterns that are considered to perform an access

View changes since the review

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants