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 | |
| 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')
| -rw-r--r-- | src/liballoc/alloc.rs | 2 | ||||
| -rw-r--r-- | src/liballoc/boxed.rs | 2 | ||||
| -rw-r--r-- | src/liballoc/collections/btree/node.rs | 48 | ||||
| -rw-r--r-- | src/liballoc/collections/vec_deque.rs | 42 | ||||
| -rw-r--r-- | src/liballoc/raw_vec.rs | 4 | ||||
| -rw-r--r-- | src/liballoc/rc.rs | 2 | ||||
| -rw-r--r-- | src/liballoc/slice.rs | 8 | ||||
| -rw-r--r-- | src/liballoc/string.rs | 14 | ||||
| -rw-r--r-- | src/liballoc/sync.rs | 2 | ||||
| -rw-r--r-- | src/liballoc/vec.rs | 32 |
10 files changed, 78 insertions, 78 deletions
diff --git a/src/liballoc/alloc.rs b/src/liballoc/alloc.rs index c69b2fb5e1c..3bd0c243b39 100644 --- a/src/liballoc/alloc.rs +++ b/src/liballoc/alloc.rs @@ -245,7 +245,7 @@ mod tests { .unwrap_or_else(|_| handle_alloc_error(layout)); let mut i = ptr.cast::<u8>().as_ptr(); - let end = i.offset(layout.size() as isize); + let end = i.add(layout.size()); while i < end { assert_eq!(*i, 0); i = i.offset(1); diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 105bf855013..32292e61f94 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -706,7 +706,7 @@ impl<T: Clone> Clone for Box<[T]> { impl<T> Drop for BoxBuilder<T> { fn drop(&mut self) { let mut data = self.data.ptr(); - let max = unsafe { data.offset(self.len as isize) }; + let max = unsafe { data.add(self.len) }; while data != max { unsafe { diff --git a/src/liballoc/collections/btree/node.rs b/src/liballoc/collections/btree/node.rs index 0ae45b31232..0315545262b 100644 --- a/src/liballoc/collections/btree/node.rs +++ b/src/liballoc/collections/btree/node.rs @@ -1151,12 +1151,12 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::KV> let new_len = self.node.len() - self.idx - 1; ptr::copy_nonoverlapping( - self.node.keys().as_ptr().offset(self.idx as isize + 1), + self.node.keys().as_ptr().add(self.idx + 1), new_node.keys.as_mut_ptr(), new_len ); ptr::copy_nonoverlapping( - self.node.vals().as_ptr().offset(self.idx as isize + 1), + self.node.vals().as_ptr().add(self.idx + 1), new_node.vals.as_mut_ptr(), new_len ); @@ -1209,17 +1209,17 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker:: let new_len = self.node.len() - self.idx - 1; ptr::copy_nonoverlapping( - self.node.keys().as_ptr().offset(self.idx as isize + 1), + self.node.keys().as_ptr().add(self.idx + 1), new_node.data.keys.as_mut_ptr(), new_len ); ptr::copy_nonoverlapping( - self.node.vals().as_ptr().offset(self.idx as isize + 1), + self.node.vals().as_ptr().add(self.idx + 1), new_node.data.vals.as_mut_ptr(), new_len ); ptr::copy_nonoverlapping( - self.node.as_internal().edges.as_ptr().offset(self.idx as isize + 1), + self.node.as_internal().edges.as_ptr().add(self.idx + 1), new_node.edges.as_mut_ptr(), new_len + 1 ); @@ -1283,14 +1283,14 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker:: slice_remove(self.node.keys_mut(), self.idx)); ptr::copy_nonoverlapping( right_node.keys().as_ptr(), - left_node.keys_mut().as_mut_ptr().offset(left_len as isize + 1), + left_node.keys_mut().as_mut_ptr().add(left_len + 1), right_len ); ptr::write(left_node.vals_mut().get_unchecked_mut(left_len), slice_remove(self.node.vals_mut(), self.idx)); ptr::copy_nonoverlapping( right_node.vals().as_ptr(), - left_node.vals_mut().as_mut_ptr().offset(left_len as isize + 1), + left_node.vals_mut().as_mut_ptr().add(left_len + 1), right_len ); @@ -1309,7 +1309,7 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker:: .as_internal_mut() .edges .as_mut_ptr() - .offset(left_len as isize + 1), + .add(left_len + 1), right_len + 1 ); @@ -1394,10 +1394,10 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker:: // Make room for stolen elements in the right child. ptr::copy(right_kv.0, - right_kv.0.offset(count as isize), + right_kv.0.add(count), right_len); ptr::copy(right_kv.1, - right_kv.1.offset(count as isize), + right_kv.1.add(count), right_len); // Move elements from the left child to the right one. @@ -1418,7 +1418,7 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker:: // Make room for stolen edges. let right_edges = right.reborrow_mut().as_internal_mut().edges.as_mut_ptr(); ptr::copy(right_edges, - right_edges.offset(count as isize), + right_edges.add(count), right_len + 1); right.correct_childrens_parent_links(count, count + right_len + 1); @@ -1463,10 +1463,10 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker:: move_kv(right_kv, count - 1, parent_kv, 0, 1); // Fix right indexing - ptr::copy(right_kv.0.offset(count as isize), + ptr::copy(right_kv.0.add(count), right_kv.0, new_right_len); - ptr::copy(right_kv.1.offset(count as isize), + ptr::copy(right_kv.1.add(count), right_kv.1, new_right_len); } @@ -1480,7 +1480,7 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker:: // Fix right indexing. let right_edges = right.reborrow_mut().as_internal_mut().edges.as_mut_ptr(); - ptr::copy(right_edges.offset(count as isize), + ptr::copy(right_edges.add(count), right_edges, new_right_len + 1); right.correct_childrens_parent_links(0, new_right_len + 1); @@ -1497,11 +1497,11 @@ unsafe fn move_kv<K, V>( dest: (*mut K, *mut V), dest_offset: usize, count: usize) { - ptr::copy_nonoverlapping(source.0.offset(source_offset as isize), - dest.0.offset(dest_offset as isize), + ptr::copy_nonoverlapping(source.0.add(source_offset), + dest.0.add(dest_offset), count); - ptr::copy_nonoverlapping(source.1.offset(source_offset as isize), - dest.1.offset(dest_offset as isize), + ptr::copy_nonoverlapping(source.1.add(source_offset), + dest.1.add(dest_offset), count); } @@ -1513,8 +1513,8 @@ unsafe fn move_edges<K, V>( { let source_ptr = source.as_internal_mut().edges.as_mut_ptr(); let dest_ptr = dest.as_internal_mut().edges.as_mut_ptr(); - ptr::copy_nonoverlapping(source_ptr.offset(source_offset as isize), - dest_ptr.offset(dest_offset as isize), + ptr::copy_nonoverlapping(source_ptr.add(source_offset), + dest_ptr.add(dest_offset), count); dest.correct_childrens_parent_links(dest_offset, dest_offset + count); } @@ -1604,8 +1604,8 @@ pub mod marker { unsafe fn slice_insert<T>(slice: &mut [T], idx: usize, val: T) { ptr::copy( - slice.as_ptr().offset(idx as isize), - slice.as_mut_ptr().offset(idx as isize + 1), + slice.as_ptr().add(idx), + slice.as_mut_ptr().add(idx + 1), slice.len() - idx ); ptr::write(slice.get_unchecked_mut(idx), val); @@ -1614,8 +1614,8 @@ unsafe fn slice_insert<T>(slice: &mut [T], idx: usize, val: T) { unsafe fn slice_remove<T>(slice: &mut [T], idx: usize) -> T { let ret = ptr::read(slice.get_unchecked(idx)); ptr::copy( - slice.as_ptr().offset(idx as isize + 1), - slice.as_mut_ptr().offset(idx as isize), + slice.as_ptr().add(idx + 1), + slice.as_mut_ptr().add(idx), slice.len() - idx - 1 ); ret diff --git a/src/liballoc/collections/vec_deque.rs b/src/liballoc/collections/vec_deque.rs index 0f759bb8f0b..55c8a78f8d0 100644 --- a/src/liballoc/collections/vec_deque.rs +++ b/src/liballoc/collections/vec_deque.rs @@ -126,13 +126,13 @@ impl<T> VecDeque<T> { /// Moves an element out of the buffer #[inline] unsafe fn buffer_read(&mut self, off: usize) -> T { - ptr::read(self.ptr().offset(off as isize)) + ptr::read(self.ptr().add(off)) } /// Writes an element into the buffer, moving it. #[inline] unsafe fn buffer_write(&mut self, off: usize, value: T) { - ptr::write(self.ptr().offset(off as isize), value); + ptr::write(self.ptr().add(off), value); } /// Returns `true` if and only if the buffer is at full capacity. @@ -177,8 +177,8 @@ impl<T> VecDeque<T> { src, len, self.cap()); - ptr::copy(self.ptr().offset(src as isize), - self.ptr().offset(dst as isize), + ptr::copy(self.ptr().add(src), + self.ptr().add(dst), len); } @@ -197,8 +197,8 @@ impl<T> VecDeque<T> { src, len, self.cap()); - ptr::copy_nonoverlapping(self.ptr().offset(src as isize), - self.ptr().offset(dst as isize), + ptr::copy_nonoverlapping(self.ptr().add(src), + self.ptr().add(dst), len); } @@ -436,7 +436,7 @@ impl<T> VecDeque<T> { pub fn get(&self, index: usize) -> Option<&T> { if index < self.len() { let idx = self.wrap_add(self.tail, index); - unsafe { Some(&*self.ptr().offset(idx as isize)) } + unsafe { Some(&*self.ptr().add(idx)) } } else { None } @@ -465,7 +465,7 @@ impl<T> VecDeque<T> { pub fn get_mut(&mut self, index: usize) -> Option<&mut T> { if index < self.len() { let idx = self.wrap_add(self.tail, index); - unsafe { Some(&mut *self.ptr().offset(idx as isize)) } + unsafe { Some(&mut *self.ptr().add(idx)) } } else { None } @@ -501,8 +501,8 @@ impl<T> VecDeque<T> { let ri = self.wrap_add(self.tail, i); let rj = self.wrap_add(self.tail, j); unsafe { - ptr::swap(self.ptr().offset(ri as isize), - self.ptr().offset(rj as isize)) + ptr::swap(self.ptr().add(ri), + self.ptr().add(rj)) } } @@ -1805,20 +1805,20 @@ impl<T> VecDeque<T> { // `at` lies in the first half. let amount_in_first = first_len - at; - ptr::copy_nonoverlapping(first_half.as_ptr().offset(at as isize), + ptr::copy_nonoverlapping(first_half.as_ptr().add(at), other.ptr(), amount_in_first); // just take all of the second half. ptr::copy_nonoverlapping(second_half.as_ptr(), - other.ptr().offset(amount_in_first as isize), + other.ptr().add(amount_in_first), second_len); } else { // `at` lies in the second half, need to factor in the elements we skipped // in the first half. let offset = at - first_len; let amount_in_second = second_len - offset; - ptr::copy_nonoverlapping(second_half.as_ptr().offset(offset as isize), + ptr::copy_nonoverlapping(second_half.as_ptr().add(offset), other.ptr(), amount_in_second); } @@ -2709,24 +2709,24 @@ impl<T> From<VecDeque<T>> for Vec<T> { // Need to move the ring to the front of the buffer, as vec will expect this. if other.is_contiguous() { - ptr::copy(buf.offset(tail as isize), buf, len); + ptr::copy(buf.add(tail), buf, len); } else { if (tail - head) >= cmp::min(cap - tail, head) { // There is enough free space in the centre for the shortest block so we can // do this in at most three copy moves. if (cap - tail) > head { // right hand block is the long one; move that enough for the left - ptr::copy(buf.offset(tail as isize), - buf.offset((tail - head) as isize), + ptr::copy(buf.add(tail), + buf.add(tail - head), cap - tail); // copy left in the end - ptr::copy(buf, buf.offset((cap - head) as isize), head); + ptr::copy(buf, buf.add(cap - head), head); // shift the new thing to the start - ptr::copy(buf.offset((tail - head) as isize), buf, len); + ptr::copy(buf.add(tail - head), buf, len); } else { // left hand block is the long one, we can do it in two! - ptr::copy(buf, buf.offset((cap - tail) as isize), head); - ptr::copy(buf.offset(tail as isize), buf, cap - tail); + ptr::copy(buf, buf.add(cap - tail), head); + ptr::copy(buf.add(tail), buf, cap - tail); } } else { // Need to use N swaps to move the ring @@ -2751,7 +2751,7 @@ impl<T> From<VecDeque<T>> for Vec<T> { for i in left_edge..right_edge { right_offset = (i - left_edge) % (cap - right_edge); let src: isize = (right_edge + right_offset) as isize; - ptr::swap(buf.offset(i as isize), buf.offset(src)); + ptr::swap(buf.add(i), buf.offset(src)); } let n_ops = right_edge - left_edge; left_edge += n_ops; 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; /// } diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index be049eb6e5e..b8f1d51db46 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -771,7 +771,7 @@ impl<T: Clone> RcFromSlice<T> for Rc<[T]> { }; for (i, item) in v.iter().enumerate() { - ptr::write(elems.offset(i as isize), item.clone()); + ptr::write(elems.add(i), item.clone()); guard.n_elems += 1; } diff --git a/src/liballoc/slice.rs b/src/liballoc/slice.rs index c27c596e797..9d442b3e00c 100644 --- a/src/liballoc/slice.rs +++ b/src/liballoc/slice.rs @@ -715,8 +715,8 @@ unsafe fn merge<T, F>(v: &mut [T], mid: usize, buf: *mut T, is_less: &mut F) { let len = v.len(); let v = v.as_mut_ptr(); - let v_mid = v.offset(mid as isize); - let v_end = v.offset(len as isize); + let v_mid = v.add(mid); + let v_end = v.add(len); // The merge process first copies the shorter run into `buf`. Then it traces the newly copied // run and the longer run forwards (or backwards), comparing their next unconsumed elements and @@ -742,7 +742,7 @@ unsafe fn merge<T, F>(v: &mut [T], mid: usize, buf: *mut T, is_less: &mut F) ptr::copy_nonoverlapping(v, buf, mid); hole = MergeHole { start: buf, - end: buf.offset(mid as isize), + end: buf.add(mid), dest: v, }; @@ -766,7 +766,7 @@ unsafe fn merge<T, F>(v: &mut [T], mid: usize, buf: *mut T, is_less: &mut F) ptr::copy_nonoverlapping(v_mid, buf, len - mid); hole = MergeHole { start: buf, - end: buf.offset((len - mid) as isize), + end: buf.add(len - mid), dest: v_mid, }; diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs index dd559df08cc..eabda7123de 100644 --- a/src/liballoc/string.rs +++ b/src/liballoc/string.rs @@ -1190,8 +1190,8 @@ impl String { let next = idx + ch.len_utf8(); let len = self.len(); unsafe { - ptr::copy(self.vec.as_ptr().offset(next as isize), - self.vec.as_mut_ptr().offset(idx as isize), + ptr::copy(self.vec.as_ptr().add(next), + self.vec.as_mut_ptr().add(idx), len - next); self.vec.set_len(len - (next - idx)); } @@ -1232,8 +1232,8 @@ impl String { del_bytes += ch_len; } else if del_bytes > 0 { unsafe { - ptr::copy(self.vec.as_ptr().offset(idx as isize), - self.vec.as_mut_ptr().offset((idx - del_bytes) as isize), + ptr::copy(self.vec.as_ptr().add(idx), + self.vec.as_mut_ptr().add(idx - del_bytes), ch_len); } } @@ -1289,11 +1289,11 @@ impl String { let amt = bytes.len(); self.vec.reserve(amt); - ptr::copy(self.vec.as_ptr().offset(idx as isize), - self.vec.as_mut_ptr().offset((idx + amt) as isize), + ptr::copy(self.vec.as_ptr().add(idx), + self.vec.as_mut_ptr().add(idx + amt), len - idx); ptr::copy(bytes.as_ptr(), - self.vec.as_mut_ptr().offset(idx as isize), + self.vec.as_mut_ptr().add(idx), amt); self.vec.set_len(len + amt); } diff --git a/src/liballoc/sync.rs b/src/liballoc/sync.rs index a00b6b4e435..2cd7898f4c7 100644 --- a/src/liballoc/sync.rs +++ b/src/liballoc/sync.rs @@ -672,7 +672,7 @@ impl<T: Clone> ArcFromSlice<T> for Arc<[T]> { }; for (i, item) in v.iter().enumerate() { - ptr::write(elems.offset(i as isize), item.clone()); + ptr::write(elems.add(i), item.clone()); guard.n_elems += 1; } diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index cc913dfbb4b..e9c1a3df518 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -692,7 +692,7 @@ impl<T> Vec<T> { pub fn truncate(&mut self, len: usize) { let current_len = self.len; unsafe { - let mut ptr = self.as_mut_ptr().offset(self.len as isize); + let mut ptr = self.as_mut_ptr().add(self.len); // Set the final length at the end, keeping in mind that // dropping an element might panic. Works around a missed // optimization, as seen in the following issue: @@ -856,7 +856,7 @@ impl<T> Vec<T> { // infallible // The spot to put the new value { - let p = self.as_mut_ptr().offset(index as isize); + let p = self.as_mut_ptr().add(index); // Shift everything over to make space. (Duplicating the // `index`th element into two consecutive places.) ptr::copy(p, p.offset(1), len - index); @@ -891,7 +891,7 @@ impl<T> Vec<T> { let ret; { // the place we are taking from. - let ptr = self.as_mut_ptr().offset(index as isize); + let ptr = self.as_mut_ptr().add(index); // copy it out, unsafely having a copy of the value on // the stack and in the vector at the same time. ret = ptr::read(ptr); @@ -1034,8 +1034,8 @@ impl<T> Vec<T> { let mut w: usize = 1; while r < ln { - let p_r = p.offset(r as isize); - let p_wm1 = p.offset((w - 1) as isize); + let p_r = p.add(r); + let p_wm1 = p.add(w - 1); if !same_bucket(&mut *p_r, &mut *p_wm1) { if r != w { let p_w = p_wm1.offset(1); @@ -1072,7 +1072,7 @@ impl<T> Vec<T> { self.reserve(1); } unsafe { - let end = self.as_mut_ptr().offset(self.len as isize); + let end = self.as_mut_ptr().add(self.len); ptr::write(end, value); self.len += 1; } @@ -1196,7 +1196,7 @@ impl<T> Vec<T> { self.set_len(start); // Use the borrow in the IterMut to indicate borrowing behavior of the // whole Drain iterator (like &mut T). - let range_slice = slice::from_raw_parts_mut(self.as_mut_ptr().offset(start as isize), + let range_slice = slice::from_raw_parts_mut(self.as_mut_ptr().add(start), end - start); Drain { tail_start: end, @@ -1290,7 +1290,7 @@ impl<T> Vec<T> { self.set_len(at); other.set_len(other_len); - ptr::copy_nonoverlapping(self.as_ptr().offset(at as isize), + ptr::copy_nonoverlapping(self.as_ptr().add(at), other.as_mut_ptr(), other.len()); } @@ -1473,7 +1473,7 @@ impl<T> Vec<T> { self.reserve(n); unsafe { - let mut ptr = self.as_mut_ptr().offset(self.len() as isize); + let mut ptr = self.as_mut_ptr().add(self.len()); // Use SetLenOnDrop to work around bug where compiler // may not realize the store through `ptr` through self.set_len() // don't alias. @@ -1799,7 +1799,7 @@ impl<T> IntoIterator for Vec<T> { let end = if mem::size_of::<T>() == 0 { arith_offset(begin as *const i8, self.len() as isize) as *const T } else { - begin.offset(self.len() as isize) as *const T + begin.add(self.len()) as *const T }; let cap = self.buf.cap(); mem::forget(self); @@ -1898,7 +1898,7 @@ impl<T, I> SpecExtend<T, I> for Vec<T> if let Some(additional) = high { self.reserve(additional); unsafe { - let mut ptr = self.as_mut_ptr().offset(self.len() as isize); + let mut ptr = self.as_mut_ptr().add(self.len()); let mut local_len = SetLenOnDrop::new(&mut self.len); for element in iterator { ptr::write(ptr, element); @@ -2561,8 +2561,8 @@ impl<'a, T> Drop for Drain<'a, T> { let start = source_vec.len(); let tail = self.tail_start; if tail != start { - let src = source_vec.as_ptr().offset(tail as isize); - let dst = source_vec.as_mut_ptr().offset(start as isize); + let src = source_vec.as_ptr().add(tail); + let dst = source_vec.as_mut_ptr().add(start); ptr::copy(src, dst, self.tail_len); } source_vec.set_len(start + self.tail_len); @@ -2672,7 +2672,7 @@ impl<'a, T> Drain<'a, T> { let range_start = vec.len; let range_end = self.tail_start; let range_slice = slice::from_raw_parts_mut( - vec.as_mut_ptr().offset(range_start as isize), + vec.as_mut_ptr().add(range_start), range_end - range_start); for place in range_slice { @@ -2693,8 +2693,8 @@ impl<'a, T> Drain<'a, T> { vec.buf.reserve(used_capacity, extra_capacity); let new_tail_start = self.tail_start + extra_capacity; - let src = vec.as_ptr().offset(self.tail_start as isize); - let dst = vec.as_mut_ptr().offset(new_tail_start as isize); + let src = vec.as_ptr().add(self.tail_start); + let dst = vec.as_mut_ptr().add(new_tail_start); ptr::copy(src, dst, self.tail_len); self.tail_start = new_tail_start; } |
