File tree 1 file changed +11
-1
lines changed
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -1387,9 +1387,19 @@ mod prim_usize {}
1387
1387
/// returning values from safe functions; such violations may result in undefined behavior. Where
1388
1388
/// exceptions to this latter requirement exist, they will be called out explicitly in documentation.
1389
1389
///
1390
+ /// For references to [slices](primitive.slice.html) and [`str`s](primitive.str.html),
1391
+ /// a consequence of the above is that their lengths must always be short enough that
1392
+ /// `size_of_val(t) <= isize::MAX`. Said otherwise, for an element type `E` where
1393
+ /// `size_of::<E>() > 0` (a non-ZST), the length of the slice must never exceed
1394
+ /// `isize::MAX / size_of::<E>()`. (Raw pointers may have longer lengths, but
1395
+ /// references must not. For example, compare the documentation of
1396
+ /// [`ptr::slice_from_raw_parts`](ptr/fn.slice_from_raw_parts.html) and
1397
+ /// [`slice::from_raw_parts`](slice/fn.from_raw_parts.html).)
1398
+ ///
1390
1399
/// It is not decided yet whether unsafe code may violate these invariants temporarily on internal
1391
1400
/// data. As a consequence, unsafe code which violates these invariants temporarily on internal data
1392
- /// may become unsound in future versions of Rust depending on how this question is decided.
1401
+ /// may already be unsound in current versions of Rust, and additional violations may become unsound
1402
+ /// in future versions of Rust depending on how this question is decided.
1393
1403
///
1394
1404
/// [allocated object]: ptr#allocated-object
1395
1405
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
You can’t perform that action at this time.
0 commit comments