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

Update ptr docs with regards to ptr::addr_of! #83553

Merged
merged 1 commit into from
May 5, 2021

Conversation

jfrimmel
Copy link
Contributor

@jfrimmel jfrimmel commented Mar 27, 2021

This updates the documentation since ptr::addr_of! and ptr::addr_of_mut! are now stable. One might remove the distinction between the sections # On packed structs and # Examples, as the old section on packed structs was primarily to prevent users of doing undefined behavior, which is not necessary anymore.

Technically there is now wrong/outdated documentation on stable, but I don't think this is worth a point release 😉

Fixes #83509.

@rustbot modify labels: T-doc

@rust-highfive
Copy link
Collaborator

r? @Mark-Simulacrum

(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 Mar 27, 2021
@rustbot rustbot added the A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools label Mar 27, 2021
@voidc
Copy link
Contributor

voidc commented Mar 27, 2021

ptr::addr_of! should probably also be mentioned here

Copy link
Member

@m-ou-se m-ou-se left a comment

Choose a reason for hiding this comment

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

Thanks! I have a few small comments:

library/core/src/ptr/mod.rs Outdated Show resolved Hide resolved
library/core/src/ptr/mod.rs Outdated Show resolved Hide resolved
library/core/src/ptr/mod.rs Outdated Show resolved Hide resolved
@m-ou-se m-ou-se assigned m-ou-se and unassigned Mark-Simulacrum Mar 27, 2021
@bors
Copy link
Contributor

bors commented Mar 27, 2021

☔ The latest upstream changes (presumably #83580) made this pull request unmergeable. Please resolve the merge conflicts.

@jfrimmel
Copy link
Contributor Author

ptr::addr_of! should probably also be mentioned here

Included in the latest commit.

Rebased to resolve merge conflicts.

@rust-log-analyzer

This comment has been minimized.

@jfrimmel jfrimmel force-pushed the addr-of branch 2 times, most recently from 177a65e to 95ea4c1 Compare March 28, 2021 10:44
library/core/src/ptr/mod.rs Outdated Show resolved Hide resolved
library/core/src/ptr/mod.rs Outdated Show resolved Hide resolved
library/std/src/primitive_docs.rs Outdated Show resolved Hide resolved
@m-ou-se m-ou-se added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 14, 2021
library/core/src/ptr/mod.rs Outdated Show resolved Hide resolved
@Soveu
Copy link
Contributor

Soveu commented Apr 21, 2021

@jfrimmel a gentle reminder, that we are waiting for you 😅

@jyn514 jyn514 added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 23, 2021
@jyn514
Copy link
Member

jyn514 commented Apr 23, 2021

@jfrimmel fyi you can change the labels with @rustbot modify labels +S-waiting-on-review -S-waiting-on-author. I'd suggest doing that whenever this is ready for review, otherwise things have a tendency to fall through the cracks until the triage team looks at them.

@jfrimmel
Copy link
Contributor Author

Thank you for the information!

@jfrimmel
Copy link
Contributor Author

I've applied the latest review. This PR contains now 6 commits, should I squash them (but I don't know whether GitHub supports multiple Co-authored-by:-lines)?

Comment on lines 452 to 454
/// Those macros have an advantage over the coercion: you can create raw
/// pointers to unaligned fields, which might be necessary if packed structs
/// are involved.
Copy link
Member

Choose a reason for hiding this comment

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

This makes it sound like unaligned fields are the only reason to use addr_of instead of coercing from a reference. But making pointers to e.g. uninitialized data is another important use case.

@m-ou-se
Copy link
Member

m-ou-se commented Apr 24, 2021

Feel free to squash the commits.

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request May 4, 2021
Update `ptr` docs with regards to `ptr::addr_of!`

This updates the documentation since `ptr::addr_of!` and `ptr::addr_of_mut!` are now stable. One might remove the distinction between the sections `# On packed structs` and `# Examples`, as the old section on packed structs was primarily to prevent users of doing undefined behavior, which is not necessary anymore.

Technically there is now wrong/outdated documentation on stable, but I don't think this is worth a point release 😉

Fixes rust-lang#83509.

`@rustbot` modify labels: T-doc
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request May 4, 2021
Update `ptr` docs with regards to `ptr::addr_of!`

This updates the documentation since `ptr::addr_of!` and `ptr::addr_of_mut!` are now stable. One might remove the distinction between the sections `# On packed structs` and `# Examples`, as the old section on packed structs was primarily to prevent users of doing undefined behavior, which is not necessary anymore.

Technically there is now wrong/outdated documentation on stable, but I don't think this is worth a point release 😉

Fixes rust-lang#83509.

``@rustbot`` modify labels: T-doc
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request May 4, 2021
Update `ptr` docs with regards to `ptr::addr_of!`

This updates the documentation since `ptr::addr_of!` and `ptr::addr_of_mut!` are now stable. One might remove the distinction between the sections `# On packed structs` and `# Examples`, as the old section on packed structs was primarily to prevent users of doing undefined behavior, which is not necessary anymore.

Technically there is now wrong/outdated documentation on stable, but I don't think this is worth a point release 😉

Fixes rust-lang#83509.

```@rustbot``` modify labels: T-doc
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request May 4, 2021
Update `ptr` docs with regards to `ptr::addr_of!`

This updates the documentation since `ptr::addr_of!` and `ptr::addr_of_mut!` are now stable. One might remove the distinction between the sections `# On packed structs` and `# Examples`, as the old section on packed structs was primarily to prevent users of doing undefined behavior, which is not necessary anymore.

Technically there is now wrong/outdated documentation on stable, but I don't think this is worth a point release 😉

Fixes rust-lang#83509.

````@rustbot```` modify labels: T-doc
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request May 4, 2021
Update `ptr` docs with regards to `ptr::addr_of!`

This updates the documentation since `ptr::addr_of!` and `ptr::addr_of_mut!` are now stable. One might remove the distinction between the sections `# On packed structs` and `# Examples`, as the old section on packed structs was primarily to prevent users of doing undefined behavior, which is not necessary anymore.

Technically there is now wrong/outdated documentation on stable, but I don't think this is worth a point release 😉

Fixes rust-lang#83509.

`````@rustbot````` modify labels: T-doc
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request May 4, 2021
Update `ptr` docs with regards to `ptr::addr_of!`

This updates the documentation since `ptr::addr_of!` and `ptr::addr_of_mut!` are now stable. One might remove the distinction between the sections `# On packed structs` and `# Examples`, as the old section on packed structs was primarily to prevent users of doing undefined behavior, which is not necessary anymore.

Technically there is now wrong/outdated documentation on stable, but I don't think this is worth a point release 😉

Fixes rust-lang#83509.

``````@rustbot`````` modify labels: T-doc
RalfJung added a commit to RalfJung/rust that referenced this pull request May 5, 2021
Update `ptr` docs with regards to `ptr::addr_of!`

This updates the documentation since `ptr::addr_of!` and `ptr::addr_of_mut!` are now stable. One might remove the distinction between the sections `# On packed structs` and `# Examples`, as the old section on packed structs was primarily to prevent users of doing undefined behavior, which is not necessary anymore.

Technically there is now wrong/outdated documentation on stable, but I don't think this is worth a point release 😉

Fixes rust-lang#83509.

```````@rustbot``````` modify labels: T-doc
RalfJung added a commit to RalfJung/rust that referenced this pull request May 5, 2021
Update `ptr` docs with regards to `ptr::addr_of!`

This updates the documentation since `ptr::addr_of!` and `ptr::addr_of_mut!` are now stable. One might remove the distinction between the sections `# On packed structs` and `# Examples`, as the old section on packed structs was primarily to prevent users of doing undefined behavior, which is not necessary anymore.

Technically there is now wrong/outdated documentation on stable, but I don't think this is worth a point release 😉

Fixes rust-lang#83509.

````````@rustbot```````` modify labels: T-doc
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request May 5, 2021
Update `ptr` docs with regards to `ptr::addr_of!`

This updates the documentation since `ptr::addr_of!` and `ptr::addr_of_mut!` are now stable. One might remove the distinction between the sections `# On packed structs` and `# Examples`, as the old section on packed structs was primarily to prevent users of doing undefined behavior, which is not necessary anymore.

Technically there is now wrong/outdated documentation on stable, but I don't think this is worth a point release 😉

Fixes rust-lang#83509.

`````````@rustbot````````` modify labels: T-doc
bors added a commit to rust-lang-ci/rust that referenced this pull request May 5, 2021
Rollup of 11 pull requests

Successful merges:

 - rust-lang#83553 (Update `ptr` docs with regards to `ptr::addr_of!`)
 - rust-lang#84183 (Update RELEASES.md for 1.52.0)
 - rust-lang#84709 (Add doc alias for `chdir` to `std::env::set_current_dir`)
 - rust-lang#84803 (Reduce duplication in `impl_dep_tracking_hash` macros)
 - rust-lang#84808 (Account for unsatisfied bounds in E0599)
 - rust-lang#84843 (use else if in std library )
 - rust-lang#84865 (rustbuild: Pass a `threads` flag that works to windows-gnu lld)
 - rust-lang#84878 (Clarify documentation for `[T]::contains`)
 - rust-lang#84882 (platform-support: Center the contents of the `std` and `host` columns)
 - rust-lang#84903 (Remove `rustc_middle::mir::interpret::CheckInAllocMsg::NullPointerTest`)
 - rust-lang#84913 (Do not ICE on invalid const param)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 722bebf into rust-lang:master May 5, 2021
@rustbot rustbot added this to the 1.54.0 milestone May 5, 2021
@jfrimmel jfrimmel deleted the addr-of branch October 14, 2021 14:03
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 S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Outdated documentation with regards to ptr::addr_of!