diff options
| author | kennytm <kennytm@gmail.com> | 2018-08-21 22:05:30 +0800 |
|---|---|---|
| committer | kennytm <kennytm@gmail.com> | 2018-08-21 22:05:30 +0800 |
| commit | 0dd88c97975b2a2e4ea3e4a2bdc3670a9f40bd67 (patch) | |
| tree | 0ad62b121fcafe2d11ee95819caf64e975d4ad00 /src/liballoc/raw_vec.rs | |
| parent | 9bbab65ebefbeb512445a759603b03f858e5e9b9 (diff) | |
| parent | 993fb934640b7e514f3c629c33a2698a83ed8c3e (diff) | |
| download | rust-0dd88c97975b2a2e4ea3e4a2bdc3670a9f40bd67.tar.gz rust-0dd88c97975b2a2e4ea3e4a2bdc3670a9f40bd67.zip | |
Rollup merge of #53329 - frewsxcv:frewsxcv-ptr-add-sub, r=RalfJung
Replace usages of ptr::offset with ptr::{add,sub}.
Rust provides these helper methods – so let's use them!
Diffstat (limited to 'src/liballoc/raw_vec.rs')
| -rw-r--r-- | src/liballoc/raw_vec.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/liballoc/raw_vec.rs b/src/liballoc/raw_vec.rs index 8b46637def0..837770feece 100644 --- a/src/liballoc/raw_vec.rs +++ b/src/liballoc/raw_vec.rs @@ -282,7 +282,7 @@ impl<T, A: Alloc> RawVec<T, A> { /// // double would have aborted or panicked if the len exceeded /// // `isize::MAX` so this is safe to do unchecked now. /// unsafe { - /// ptr::write(self.buf.ptr().offset(self.len as isize), elem); + /// ptr::write(self.buf.ptr().add(self.len), elem); /// } /// self.len += 1; /// } @@ -487,7 +487,7 @@ impl<T, A: Alloc> RawVec<T, A> { /// // `isize::MAX` so this is safe to do unchecked now. /// for x in elems { /// unsafe { - /// ptr::write(self.buf.ptr().offset(self.len as isize), x.clone()); + /// ptr::write(self.buf.ptr().add(self.len), x.clone()); /// } /// self.len += 1; /// } |
