Skip to content
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

Some docs about pointers recommend addr_of macros instead of &raw #133024

Closed
CatsAreFluffy opened this issue Nov 14, 2024 · 2 comments · Fixed by #133048
Closed

Some docs about pointers recommend addr_of macros instead of &raw #133024

CatsAreFluffy opened this issue Nov 14, 2024 · 2 comments · Fixed by #133048
Assignees
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. Libs-Small Libs issues that are considered "small" or self-contained T-libs Relevant to the library team, which will review and decide on the PR/issue.

Comments

@CatsAreFluffy
Copy link

CatsAreFluffy commented Nov 14, 2024

Location

Primitive type pointer
core::ptr::read_unaligned
core::ptr::write_unaligned

Summary

The above documentation pages suggest using ptr::addr_of and ptr::addr_of_mut respectively, but the pages for those macros recommend using &raw const and &raw mut instead.

@CatsAreFluffy CatsAreFluffy added the A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools label Nov 14, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 14, 2024
@Noratrieb Noratrieb added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. Libs-Small Libs issues that are considered "small" or self-contained and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Nov 14, 2024
@cyrgani
Copy link
Contributor

cyrgani commented Nov 14, 2024

@rustbot claim

@CatsAreFluffy
Copy link
Author

CatsAreFluffy commented Nov 15, 2024

#133048 doesn't fix the reference in Primitive type pointer (which, incidentally, doesn't end in a period, whereas the other entries in that list do)

workingjubilee added a commit to workingjubilee/rustc that referenced this issue Nov 15, 2024
use `&raw` in `{read, write}_unaligned` documentation

Fixes rust-lang#133024 by using `&raw const` and `&raw mut` instead of `addr_of!` and `addr_of_mut!`.
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Nov 15, 2024
Rollup merge of rust-lang#133048 - cyrgani:ptr-doc-update, r=Amanieu

use `&raw` in `{read, write}_unaligned` documentation

Fixes rust-lang#133024 by using `&raw const` and `&raw mut` instead of `addr_of!` and `addr_of_mut!`.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Dec 22, 2024
Use `&raw` for `ptr` primitive docs

Fixes the first item in rust-lang#133024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Dec 22, 2024
Rollup merge of rust-lang#134630 - fifty-six:master, r=workingjubilee

Use `&raw` for `ptr` primitive docs

Fixes the first item in rust-lang#133024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. Libs-Small Libs issues that are considered "small" or self-contained T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants