]> git.lizzy.rs Git - rust.git/commitdiff
Fix off-by-one error when specifying a valid range
authorDylan MacKenzie <ecstaticmorse@gmail.com>
Tue, 5 Jun 2018 20:17:24 +0000 (13:17 -0700)
committerRalf Jung <post@ralfj.de>
Wed, 29 Aug 2018 08:10:58 +0000 (10:10 +0200)
src/libcore/intrinsics.rs
src/libcore/ptr.rs

index 1c400cbdfcb393685b8e410367d51161102f66c8..ba16715a6b88f54d67de9b749a368e08680d5719 100644 (file)
     ///
     /// * Both `src` and `dst` must be properly aligned.
     ///
-    /// * `src.offset(count)` must be [valid]. In other words, the region of
+    /// * `src.offset(count-1)` must be [valid]. In other words, the region of
     ///   memory which begins at `src` and has a length of `count *
     ///   size_of::<T>()` bytes must belong to a single, live allocation.
     ///
-    /// * `dst.offset(count)` must be [valid]. In other words, the region of
+    /// * `dst.offset(count-1)` must be [valid]. In other words, the region of
     ///   memory which begins at `dst` and has a length of `count *
     ///   size_of::<T>()` bytes must belong to a single, live allocation.
     ///
     ///
     /// * Both `src` and `dst` must be properly aligned.
     ///
-    /// * `src.offset(count)` must be [valid]. In other words, the region of
+    /// * `src.offset(count-1)` must be [valid]. In other words, the region of
     ///   memory which begins at `src` and has a length of `count *
     ///   size_of::<T>()` bytes must belong to a single, live allocation.
     ///
-    /// * `dst.offset(count)` must be [valid]. In other words, the region of
+    /// * `dst.offset(count-1)` must be [valid]. In other words, the region of
     ///   memory which begins at `dst` and has a length of `count *
     ///   size_of::<T>()` bytes must belong to a single, live allocation.
     ///
     ///
     /// * `dst` must be [valid].
     ///
-    /// * `dst.offset(count)` must be [valid]. In other words, the region of
+    /// * `dst.offset(count-1)` must be [valid]. In other words, the region of
     ///   memory which begins at `dst` and has a length of `count *
     ///   size_of::<T>()` bytes must belong to a single, live allocation.
     ///
index f15ad7c05cb138ab89e067792ac5790e89637f45..a28b3422d1b4efa66085afe3b2c23c0f352d66b2 100644 (file)
@@ -237,11 +237,11 @@ pub unsafe fn swap<T>(x: *mut T, y: *mut T) {
 ///
 /// * Both `x` and `y` must be properly aligned.
 ///
-/// * `x.offset(count)` must be [valid]. In other words, the region of memory
+/// * `x.offset(count-1)` must be [valid]. In other words, the region of memory
 ///   which begins at `x` and has a length of `count * size_of::<T>()` bytes
 ///   must belong to a single, live allocation.
 ///
-/// * `y.offset(count)` must be [valid]. In other words, the region of memory
+/// * `y.offset(count-1)` must be [valid]. In other words, the region of memory
 ///   which begins at `y` and has a length of `count * size_of::<T>()` bytes
 ///   must belong to a single, live allocation.
 ///