@@ -3839,10 +3839,9 @@ unsafe impl<'a, T> TrustedRandomAccess for ExactChunksMut<'a, T> {
3839
3839
/// valid for `len` elements, nor whether the lifetime inferred is a suitable
3840
3840
/// lifetime for the returned slice.
3841
3841
///
3842
- /// `p` must be non-null, even for zero-length slices, because non-zero bits
3843
- /// are required to distinguish between a zero-length slice within `Some()`
3844
- /// from `None`. `p` can be a bogus non-dereferencable pointer, such as `0x1`,
3845
- /// for zero-length slices, though.
3842
+ /// `p` must be non-null and aligned, even for zero-length slices, as is
3843
+ /// required for all references. However, for zero-length slices, `p` can be
3844
+ /// a bogus non-dereferencable pointer such as [`NonNull::dangling()`].
3846
3845
///
3847
3846
/// # Caveat
3848
3847
///
@@ -3864,6 +3863,8 @@ unsafe impl<'a, T> TrustedRandomAccess for ExactChunksMut<'a, T> {
3864
3863
/// let slice = slice::from_raw_parts(ptr, amt);
3865
3864
/// }
3866
3865
/// ```
3866
+ ///
3867
+ /// [`NonNull::dangling()`]: ../../std/ptr/struct.NonNull.html#method.dangling
3867
3868
#[ inline]
3868
3869
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
3869
3870
pub unsafe fn from_raw_parts < ' a , T > ( data : * const T , len : usize ) -> & ' a [ T ] {
@@ -3875,7 +3876,7 @@ pub unsafe fn from_raw_parts<'a, T>(data: *const T, len: usize) -> &'a [T] {
3875
3876
///
3876
3877
/// This function is unsafe for the same reasons as `from_raw_parts`, as well
3877
3878
/// as not being able to provide a non-aliasing guarantee of the returned
3878
- /// mutable slice. `p` must be non-null even for zero-length slices as with
3879
+ /// mutable slice. `p` must be non-null and aligned even for zero-length slices as with
3879
3880
/// `from_raw_parts`.
3880
3881
#[ inline]
3881
3882
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
0 commit comments