-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Open
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Description
The union RFC says:
In addition, since a union declared without
#[repr(C)]
uses an unspecified binary layout, code reading fields of such a union or pattern-matching such a union must not read from a field other than the one written to.
However, there are several cases which explicitly read from a field different from the one written to, for example, str.as_bytes()
which was introduced in #50863 to make many of the stuff const
.
Metadata
Metadata
Assignees
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.