mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-26 13:01:27 +03:00
Rollup merge of #155427 - tshepang:tshepang/match-text-in-with_addr, r=scottmcm
ptr: update text in intro text to one in with_addr doc The one where this was copied from has since been updated.
This commit is contained in:
@@ -262,16 +262,15 @@
|
||||
//! [`with_addr`] method:
|
||||
//!
|
||||
//! ```text
|
||||
//! /// Creates a new pointer with the given address.
|
||||
//! ///
|
||||
//! /// This performs the same operation as an `addr as ptr` cast, but copies
|
||||
//! /// the *provenance* of `self` to the new pointer.
|
||||
//! /// This allows us to dynamically preserve and propagate this important
|
||||
//! /// information in a way that is otherwise impossible with a unary cast.
|
||||
//! ///
|
||||
//! /// This is equivalent to using `wrapping_offset` to offset `self` to the
|
||||
//! /// given address, and therefore has all the same capabilities and restrictions.
|
||||
//! pub fn with_addr(self, addr: usize) -> Self;
|
||||
//! /// Creates a new pointer with the given address and the provenance of `self`.
|
||||
//! ///
|
||||
//! /// This is similar to a `addr as *const T` cast,
|
||||
//! /// but copies the provenance of `self` to the new pointer.
|
||||
//! /// This avoids the inherent ambiguity of the unary cast.
|
||||
//! ///
|
||||
//! /// This is equivalent to using `wrapping_offset` to offset `self` to the given address,
|
||||
//! /// and therefore has all the same capabilities and restrictions.
|
||||
//! pub fn with_addr(self, addr: usize) -> Self;
|
||||
//! ```
|
||||
//!
|
||||
//! So you're still able to drop down to the address representation and do whatever
|
||||
|
||||
Reference in New Issue
Block a user