about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorDylan MacKenzie <ecstaticmorse@gmail.com>2018-06-05 13:17:24 -0700
committerRalf Jung <post@ralfj.de>2018-08-29 10:10:58 +0200
commit30122e91d95e63dc47063b3b596c72ba65eec0a1 (patch)
tree1297ffcf96f4526079230821aad82315dfd68fb5 /src/libcore
parent6f7338bb9246abc5078529e218fded18e8766926 (diff)
downloadrust-30122e91d95e63dc47063b3b596c72ba65eec0a1.tar.gz
rust-30122e91d95e63dc47063b3b596c72ba65eec0a1.zip
Fix off-by-one error when specifying a valid range
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/intrinsics.rs10
-rw-r--r--src/libcore/ptr.rs4
2 files changed, 7 insertions, 7 deletions
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs
index 1c400cbdfcb..ba16715a6b8 100644
--- a/src/libcore/intrinsics.rs
+++ b/src/libcore/intrinsics.rs
@@ -980,11 +980,11 @@ extern "rust-intrinsic" {
     ///
     /// * 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.
     ///
@@ -1068,11 +1068,11 @@ extern "rust-intrinsic" {
     ///
     /// * 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.
     ///
@@ -1118,7 +1118,7 @@ extern "rust-intrinsic" {
     ///
     /// * `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.
     ///
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs
index f15ad7c05cb..a28b3422d1b 100644
--- a/src/libcore/ptr.rs
+++ b/src/libcore/ptr.rs
@@ -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.
 ///