about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorSteve Klabnik <steve@steveklabnik.com>2015-07-08 10:34:27 -0400
committerSteve Klabnik <steve@steveklabnik.com>2015-07-08 10:34:27 -0400
commitbd1033d738430af0a2c59f226770bdead711d85e (patch)
tree44c16f5067535e50fc210a42b29ef2c63d09cf10 /src/libcore
parent80f9d935859a8ae783fdc85656fe498a59e8ebc2 (diff)
parent80f269259c734d25bb4e9586d1cbde8638dcda26 (diff)
downloadrust-bd1033d738430af0a2c59f226770bdead711d85e.tar.gz
rust-bd1033d738430af0a2c59f226770bdead711d85e.zip
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
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/slice.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs
index a8c995f37cc..797f9c36872 100644
--- a/src/libcore/slice.rs
+++ b/src/libcore/slice.rs
@@ -1368,10 +1368,14 @@ pub fn mut_ref_slice<'a, A>(s: &'a mut A) -> &'a mut [A] {
 ///
 /// The `len` argument is the number of **elements**, not the number of bytes.
 ///
+/// # Unsafety
+///
 /// This function is unsafe as there is no guarantee that the given pointer is
 /// valid for `len` elements, nor whether the lifetime inferred is a suitable
 /// lifetime for the returned slice.
 ///
+/// `p` must be non-null, even for zero-length slices.
+///
 /// # Caveat
 ///
 /// The lifetime for the returned slice is inferred from its usage. To