-
Notifications
You must be signed in to change notification settings - Fork 13.3k
fix Pointer to reference conversion docs #129652
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
Conversation
//! there are several rules that must be followed: | ||
//! | ||
//! * The pointer must be properly aligned. | ||
//! | ||
// some microprocessors may use address 0 for an interrupt vector. | ||
// users of these microprocessors must always read/write address 0 through | ||
// a raw pointer, not a reference. |
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.
I'm not sure what the point of this was, it was anyway hidden from users. If we want to give guidance on how to access address 0, this is the wrong place. (I think currently it is always UB to access address 0, even with raw pointers.)
//! uninitialized memory through careful use of `MaybeUninit`, | ||
//! or if the uninitialized memory is entirely contained within | ||
//! padding bytes, since | ||
//! [padding has the same validity invariant as `MaybeUninit`][ucg-pad]. |
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.
I don't think we should repeat the validity rules here, let's just point to the reference instead.
This comment has been minimized.
This comment has been minimized.
Fixed some links. |
fix Pointer to reference conversion docs The aliasing rules documented in rust-lang#128157 are wrong, this fixes them.
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#129401 (Partially stabilize `feature(new_uninit)`) - rust-lang#129581 (exit: explain our expectations for the exit handlers registered in a Rust program) - rust-lang#129634 (Fix tidy to allow `edition = "2024"` in `Cargo.toml`) - rust-lang#129635 (Use unsafe extern blocks throughout the compiler) - rust-lang#129645 (Fix typos in floating-point primitive type docs) - rust-lang#129648 (More `unreachable_pub`) - rust-lang#129649 (ABI compat check: detect unadjusted ABI mismatches) - rust-lang#129652 (fix Pointer to reference conversion docs) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#129507 (make it possible to enable const_precise_live_drops per-function) - rust-lang#129581 (exit: explain our expectations for the exit handlers registered in a Rust program) - rust-lang#129634 (Fix tidy to allow `edition = "2024"` in `Cargo.toml`) - rust-lang#129635 (Use unsafe extern blocks throughout the compiler) - rust-lang#129645 (Fix typos in floating-point primitive type docs) - rust-lang#129648 (More `unreachable_pub`) - rust-lang#129649 (ABI compat check: detect unadjusted ABI mismatches) - rust-lang#129652 (fix Pointer to reference conversion docs) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#129507 (make it possible to enable const_precise_live_drops per-function) - rust-lang#129581 (exit: explain our expectations for the exit handlers registered in a Rust program) - rust-lang#129634 (Fix tidy to allow `edition = "2024"` in `Cargo.toml`) - rust-lang#129635 (Use unsafe extern blocks throughout the compiler) - rust-lang#129645 (Fix typos in floating-point primitive type docs) - rust-lang#129648 (More `unreachable_pub`) - rust-lang#129649 (ABI compat check: detect unadjusted ABI mismatches) - rust-lang#129652 (fix Pointer to reference conversion docs) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#129652 - RalfJung:ptr-to-ref, r=traviscross fix Pointer to reference conversion docs The aliasing rules documented in rust-lang#128157 are wrong, this fixes them.
The aliasing rules documented in #128157 are wrong, this fixes them.