-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
|
There was a problem hiding this 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:
☔ The latest upstream changes (presumably #83580) made this pull request unmergeable. Please resolve the merge conflicts. |
Included in the latest commit. Rebased to resolve merge conflicts. |
This comment has been minimized.
This comment has been minimized.
177a65e
to
95ea4c1
Compare
@jfrimmel a gentle reminder, that we are waiting for you 😅 |
@jfrimmel fyi you can change the labels with |
Thank you for the information! |
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 |
library/std/src/primitive_docs.rs
Outdated
/// 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. |
There was a problem hiding this comment.
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.
Feel free to squash the commits. |
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
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
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
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
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
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
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
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
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
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
This updates the documentation since
ptr::addr_of!
andptr::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