Skip to content

Commit aa72b1d

Browse files
committed
note about stack-allocated variables being allocated objects
1 parent 4be0675 commit aa72b1d

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

src/libcore/ptr/mod.rs

+16-8
Original file line numberDiff line numberDiff line change
@@ -1120,7 +1120,8 @@ impl<T: ?Sized> *const T {
11201120
/// Behavior:
11211121
///
11221122
/// * Both the starting and resulting pointer must be either in bounds or one
1123-
/// byte past the end of the same allocated object.
1123+
/// byte past the end of the same allocated object. Note that in Rust,
1124+
/// every (stack-allocated) variable is considered a separate allocated object.
11241125
///
11251126
/// * The computed offset, **in bytes**, cannot overflow an `isize`.
11261127
///
@@ -1223,7 +1224,8 @@ impl<T: ?Sized> *const T {
12231224
/// Behavior:
12241225
///
12251226
/// * Both the starting and other pointer must be either in bounds or one
1226-
/// byte past the end of the same allocated object.
1227+
/// byte past the end of the same allocated object. Note that in Rust,
1228+
/// every (stack-allocated) variable is considered a separate allocated object.
12271229
///
12281230
/// * The distance between the pointers, **in bytes**, cannot overflow an `isize`.
12291231
///
@@ -1338,7 +1340,8 @@ impl<T: ?Sized> *const T {
13381340
/// Behavior:
13391341
///
13401342
/// * Both the starting and resulting pointer must be either in bounds or one
1341-
/// byte past the end of the same allocated object.
1343+
/// byte past the end of the same allocated object. Note that in Rust,
1344+
/// every (stack-allocated) variable is considered a separate allocated object.
13421345
///
13431346
/// * The computed offset, **in bytes**, cannot overflow an `isize`.
13441347
///
@@ -1395,7 +1398,8 @@ impl<T: ?Sized> *const T {
13951398
/// Behavior:
13961399
///
13971400
/// * Both the starting and resulting pointer must be either in bounds or one
1398-
/// byte past the end of the same allocated object.
1401+
/// byte past the end of the same allocated object. Note that in Rust,
1402+
/// every (stack-allocated) variable is considered a separate allocated object.
13991403
///
14001404
/// * The computed offset cannot exceed `isize::MAX` **bytes**.
14011405
///
@@ -1755,7 +1759,8 @@ impl<T: ?Sized> *mut T {
17551759
/// Behavior:
17561760
///
17571761
/// * Both the starting and resulting pointer must be either in bounds or one
1758-
/// byte past the end of the same allocated object.
1762+
/// byte past the end of the same allocated object. Note that in Rust,
1763+
/// every (stack-allocated) variable is considered a separate allocated object.
17591764
///
17601765
/// * The computed offset, **in bytes**, cannot overflow an `isize`.
17611766
///
@@ -1901,7 +1906,8 @@ impl<T: ?Sized> *mut T {
19011906
/// Behavior:
19021907
///
19031908
/// * Both the starting and other pointer must be either in bounds or one
1904-
/// byte past the end of the same allocated object.
1909+
/// byte past the end of the same allocated object. Note that in Rust,
1910+
/// every (stack-allocated) variable is considered a separate allocated object.
19051911
///
19061912
/// * The distance between the pointers, **in bytes**, cannot overflow an `isize`.
19071913
///
@@ -2005,7 +2011,8 @@ impl<T: ?Sized> *mut T {
20052011
/// Behavior:
20062012
///
20072013
/// * Both the starting and resulting pointer must be either in bounds or one
2008-
/// byte past the end of the same allocated object.
2014+
/// byte past the end of the same allocated object. Note that in Rust,
2015+
/// every (stack-allocated) variable is considered a separate allocated object.
20092016
///
20102017
/// * The computed offset, **in bytes**, cannot overflow an `isize`.
20112018
///
@@ -2062,7 +2069,8 @@ impl<T: ?Sized> *mut T {
20622069
/// Behavior:
20632070
///
20642071
/// * Both the starting and resulting pointer must be either in bounds or one
2065-
/// byte past the end of the same allocated object.
2072+
/// byte past the end of the same allocated object. Note that in Rust,
2073+
/// every (stack-allocated) variable is considered a separate allocated object.
20662074
///
20672075
/// * The computed offset cannot exceed `isize::MAX` **bytes**.
20682076
///

0 commit comments

Comments
 (0)