]> git.lizzy.rs Git - rust.git/commitdiff
Fix `Safety` docs for `from_raw_parts_mut`
authoraticu <15schnic@gmail.com>
Fri, 17 Jul 2020 17:47:25 +0000 (19:47 +0200)
committeraticu <15schnic@gmail.com>
Fri, 17 Jul 2020 17:47:25 +0000 (19:47 +0200)
src/libcore/slice/mod.rs

index 309a4ddb00657506181556b2c08dc3d3d34619ee..20b2c3d3c965a8eb2c4cbc7d5de1e2891492cd1b 100644 (file)
@@ -6095,7 +6095,7 @@ pub unsafe fn from_raw_parts<'a, T>(data: *const T, len: usize) -> &'a [T] {
 ///
 /// Behavior is undefined if any of the following conditions are violated:
 ///
-/// * `data` must be [valid] for writes for `len * mem::size_of::<T>()` many bytes,
+/// * `data` must be [valid] for boths reads and writes for `len * mem::size_of::<T>()` many bytes,
 ///   and it must be properly aligned. This means in particular:
 ///
 ///     * The entire memory range of this slice must be contained within a single allocated object!