Skip to content

Commit bd1033d

Browse files
committed
Rollup merge of #26891 - steveklabnik:gh26552, r=huonw
Added a proper Unsafety header, as well as mentioning that the pointer shouldn't be null. Fixes #26552
2 parents 80f9d93 + 80f2692 commit bd1033d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/libcore/slice.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,10 +1368,14 @@ pub fn mut_ref_slice<'a, A>(s: &'a mut A) -> &'a mut [A] {
13681368
///
13691369
/// The `len` argument is the number of **elements**, not the number of bytes.
13701370
///
1371+
/// # Unsafety
1372+
///
13711373
/// This function is unsafe as there is no guarantee that the given pointer is
13721374
/// valid for `len` elements, nor whether the lifetime inferred is a suitable
13731375
/// lifetime for the returned slice.
13741376
///
1377+
/// `p` must be non-null, even for zero-length slices.
1378+
///
13751379
/// # Caveat
13761380
///
13771381
/// The lifetime for the returned slice is inferred from its usage. To

0 commit comments

Comments
 (0)