Skip to content

Update ptr::{read,write}_unaligned docs to reference addr_of(_mut) #84778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

asquared31415
Copy link
Contributor

The ptr::read_unaligned and ptr::write_unaligned docs state that "It is currently impossible to create raw pointers to unaligned fields of a packed struct." This is no longer true with the introduction of addr_of! and addr_of_mut!. This updates the documentation to refer to those macros to create raw pointers, and copies the examples in those macros (which already used read/write unaligned).

@rust-highfive
Copy link
Contributor

r? @kennytm

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 1, 2021
@Soveu
Copy link
Contributor

Soveu commented May 1, 2021

There is already #83553, @jfrimmel just needs to squash commits

@JohnTitor
Copy link
Member

I'm going to close in favor of the above PR, feel free to leave a comment there if you have some thoughts. Thanks!

@JohnTitor JohnTitor closed this May 1, 2021
@asquared31415
Copy link
Contributor Author

Oh whoops I didn't see that PR, that looks good!

@asquared31415 asquared31415 deleted the ptr_unaligned_docs branch May 6, 2021 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants