@@ -189,8 +189,7 @@ impl<T: ?Sized> *mut T {
189189 /// Behavior:
190190 ///
191191 /// * Both the starting and resulting pointer must be either in bounds or one
192- /// byte past the end of the same allocated object. Note that in Rust,
193- /// every (stack-allocated) variable is considered a separate allocated object.
192+ /// byte past the end of the same [allocated object].
194193 ///
195194 /// * The computed offset, **in bytes**, cannot overflow an `isize`.
196195 ///
@@ -215,6 +214,7 @@ impl<T: ?Sized> *mut T {
215214 /// enables more aggressive compiler optimizations.
216215 ///
217216 /// [`wrapping_offset`]: #method.wrapping_offset
217+ /// [allocated object]: crate::ptr#allocated-object
218218 ///
219219 /// # Examples
220220 ///
@@ -251,9 +251,8 @@ impl<T: ?Sized> *mut T {
251251 ///
252252 /// This operation itself is always safe, but using the resulting pointer is not.
253253 ///
254- /// The resulting pointer remains attached to the same allocated object that `self` points to.
255- /// It may *not* be used to access a different allocated object. Note that in Rust, every
256- /// (stack-allocated) variable is considered a separate allocated object.
254+ /// The resulting pointer remains attached to the same [allocated object] that `self` points to.
255+ /// It may *not* be used to access a different allocated object.
257256 ///
258257 /// In other words, `let z = x.wrapping_offset((y as isize) - (x as isize))` does *not* make `z`
259258 /// the same as `y` even if we assume `T` has size `1` and there is no overflow: `z` is still
@@ -275,6 +274,7 @@ impl<T: ?Sized> *mut T {
275274 /// do the arithmetic there.
276275 ///
277276 /// [`offset`]: #method.offset
277+ /// [allocated object]: crate::ptr#allocated-object
278278 ///
279279 /// # Examples
280280 ///
@@ -485,8 +485,7 @@ impl<T: ?Sized> *mut T {
485485 /// Behavior:
486486 ///
487487 /// * Both the starting and other pointer must be either in bounds or one
488- /// byte past the end of the same allocated object. Note that in Rust,
489- /// every (stack-allocated) variable is considered a separate allocated object.
488+ /// byte past the end of the same [allocated object].
490489 ///
491490 /// * Both pointers must be *derived from* a pointer to the same object.
492491 /// (See below for an example.)
@@ -516,6 +515,7 @@ impl<T: ?Sized> *mut T {
516515 /// such large allocations either.)
517516 ///
518517 /// [`add`]: #method.add
518+ /// [allocated object]: crate::ptr#allocated-object
519519 ///
520520 /// # Panics
521521 ///
@@ -575,8 +575,7 @@ impl<T: ?Sized> *mut T {
575575 /// Behavior:
576576 ///
577577 /// * Both the starting and resulting pointer must be either in bounds or one
578- /// byte past the end of the same allocated object. Note that in Rust,
579- /// every (stack-allocated) variable is considered a separate allocated object.
578+ /// byte past the end of the same [allocated object].
580579 ///
581580 /// * The computed offset, **in bytes**, cannot overflow an `isize`.
582581 ///
@@ -639,8 +638,7 @@ impl<T: ?Sized> *mut T {
639638 /// Behavior:
640639 ///
641640 /// * Both the starting and resulting pointer must be either in bounds or one
642- /// byte past the end of the same allocated object. Note that in Rust,
643- /// every (stack-allocated) variable is considered a separate allocated object.
641+ /// byte past the end of the same [allocated object].
644642 ///
645643 /// * The computed offset cannot exceed `isize::MAX` **bytes**.
646644 ///
@@ -665,6 +663,7 @@ impl<T: ?Sized> *mut T {
665663 /// enables more aggressive compiler optimizations.
666664 ///
667665 /// [`wrapping_sub`]: #method.wrapping_sub
666+ /// [allocated object]: crate::ptr#allocated-object
668667 ///
669668 /// # Examples
670669 ///
@@ -701,9 +700,8 @@ impl<T: ?Sized> *mut T {
701700 ///
702701 /// This operation itself is always safe, but using the resulting pointer is not.
703702 ///
704- /// The resulting pointer remains attached to the same allocated object that `self` points to.
705- /// It may *not* be used to access a different allocated object. Note that in Rust, every
706- /// (stack-allocated) variable is considered a separate allocated object.
703+ /// The resulting pointer remains attached to the same [allocated object] that `self` points to.
704+ /// It may *not* be used to access a different allocated object.
707705 ///
708706 /// In other words, `let z = x.wrapping_add((y as usize) - (x as usize))` does *not* make `z`
709707 /// the same as `y` even if we assume `T` has size `1` and there is no overflow: `z` is still
@@ -725,6 +723,7 @@ impl<T: ?Sized> *mut T {
725723 /// do the arithmetic there.
726724 ///
727725 /// [`add`]: #method.add
726+ /// [allocated object]: crate::ptr#allocated-object
728727 ///
729728 /// # Examples
730729 ///
@@ -766,9 +765,8 @@ impl<T: ?Sized> *mut T {
766765 ///
767766 /// This operation itself is always safe, but using the resulting pointer is not.
768767 ///
769- /// The resulting pointer remains attached to the same allocated object that `self` points to.
770- /// It may *not* be used to access a different allocated object. Note that in Rust, every
771- /// (stack-allocated) variable is considered a separate allocated object.
768+ /// The resulting pointer remains attached to the same [allocated object] that `self` points to.
769+ /// It may *not* be used to access a different allocated object.
772770 ///
773771 /// In other words, `let z = x.wrapping_sub((x as usize) - (y as usize))` does *not* make `z`
774772 /// the same as `y` even if we assume `T` has size `1` and there is no overflow: `z` is still
@@ -790,6 +788,7 @@ impl<T: ?Sized> *mut T {
790788 /// do the arithmetic there.
791789 ///
792790 /// [`sub`]: #method.sub
791+ /// [allocated object]: crate::ptr#allocated-object
793792 ///
794793 /// # Examples
795794 ///
@@ -1261,7 +1260,7 @@ impl<T> *mut [T] {
12611260 /// * The pointer must be [valid] for reads for `ptr.len() * mem::size_of::<T>()` many bytes,
12621261 /// and it must be properly aligned. This means in particular:
12631262 ///
1264- /// * The entire memory range of this slice must be contained within a single allocated object!
1263+ /// * The entire memory range of this slice must be contained within a single [ allocated object] !
12651264 /// Slices can never span across multiple allocated objects.
12661265 ///
12671266 /// * The pointer must be aligned even for zero-length slices. One
@@ -1283,6 +1282,7 @@ impl<T> *mut [T] {
12831282 /// See also [`slice::from_raw_parts`][].
12841283 ///
12851284 /// [valid]: crate::ptr#safety
1285+ /// [allocated object]: crate::ptr#allocated-object
12861286 #[ inline]
12871287 #[ unstable( feature = "ptr_as_uninit" , issue = "75402" ) ]
12881288 pub unsafe fn as_uninit_slice < ' a > ( self ) -> Option < & ' a [ MaybeUninit < T > ] > {
@@ -1311,7 +1311,7 @@ impl<T> *mut [T] {
13111311 /// * The pointer must be [valid] for reads and writes for `ptr.len() * mem::size_of::<T>()`
13121312 /// many bytes, and it must be properly aligned. This means in particular:
13131313 ///
1314- /// * The entire memory range of this slice must be contained within a single allocated object!
1314+ /// * The entire memory range of this slice must be contained within a single [ allocated object] !
13151315 /// Slices can never span across multiple allocated objects.
13161316 ///
13171317 /// * The pointer must be aligned even for zero-length slices. One
@@ -1333,6 +1333,7 @@ impl<T> *mut [T] {
13331333 /// See also [`slice::from_raw_parts_mut`][].
13341334 ///
13351335 /// [valid]: crate::ptr#safety
1336+ /// [allocated object]: crate::ptr#allocated-object
13361337 #[ inline]
13371338 #[ unstable( feature = "ptr_as_uninit" , issue = "75402" ) ]
13381339 pub unsafe fn as_uninit_slice_mut < ' a > ( self ) -> Option < & ' a mut [ MaybeUninit < T > ] > {
0 commit comments