diff options
| author | Steve Klabnik <steve@steveklabnik.com> | 2015-07-08 13:04:41 -0400 |
|---|---|---|
| committer | Steve Klabnik <steve@steveklabnik.com> | 2015-07-08 13:04:41 -0400 |
| commit | 80f269259c734d25bb4e9586d1cbde8638dcda26 (patch) | |
| tree | d06f9be65c9ea83ca85cf4d94e090bf13519ba12 | |
| parent | 50df2a09b8b9dd4883eb27d833a8482799175a3b (diff) | |
| download | rust-80f269259c734d25bb4e9586d1cbde8638dcda26.tar.gz rust-80f269259c734d25bb4e9586d1cbde8638dcda26.zip | |
Fix up unsafe section of slice::from_raw_parts
Added a proper Unsafety header, as well as mentioning that the pointer shouldn't be null. Fixes #26552
| -rw-r--r-- | src/libcore/slice.rs | 4 |
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 |
