-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
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-bugCategory: This is a bug.Category: This is a bug.T-langRelevant to the language teamRelevant to the language teamT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
The docs for ptr::drop_in_place
state:
Unaligned values cannot be dropped in place, they must be copied to an aligned location first:
And include an example which uses ptr::copy
to copy the value from an unaligned pointer into an aligned one. However, the docs for ptr::copy
state:
Both
src
anddst
must be properly aligned.
Either the docs for ptr::copy
are wrong, and src
does not need to be aligned, or the example for drop_in_place
invokes UB and should be updated to use read_unaligned
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-bugCategory: This is a bug.Category: This is a bug.T-langRelevant to the language teamRelevant to the language teamT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.