From: Dylan MacKenzie Date: Tue, 5 Jun 2018 20:17:24 +0000 (-0700) Subject: Fix off-by-one error when specifying a valid range X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=30122e91d95e63dc47063b3b596c72ba65eec0a1;p=rust.git Fix off-by-one error when specifying a valid range --- 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 @@ /// /// * 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::()` 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::()` bytes must belong to a single, live allocation. /// @@ -1068,11 +1068,11 @@ /// /// * 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::()` 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::()` bytes must belong to a single, live allocation. /// @@ -1118,7 +1118,7 @@ /// /// * `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::()` 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(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::()` 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::()` bytes /// must belong to a single, live allocation. ///