]> git.lizzy.rs Git - rust.git/commitdiff
Revert "Slightly refactor VecDeque implementation"
authorAlex Crichton <alex@alexcrichton.com>
Fri, 5 Oct 2018 16:15:57 +0000 (09:15 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Fri, 5 Oct 2018 16:15:57 +0000 (09:15 -0700)
This reverts commit 6ce76acae455a32113116cd2f95f8076388fc2d3.

src/liballoc/collections/vec_deque.rs

index d49cb9857740d6d096a6e83420522a423d9b1f66..571f35a2031d2a0b9e1eb57ac1f9728ca2fb245f 100644 (file)
@@ -1024,7 +1024,7 @@ pub fn drain<R>(&mut self, range: R) -> Drain<T>
             iter: Iter {
                 tail: drain_tail,
                 head: drain_head,
-                ring: unsafe { self.buffer_as_slice() },
+                ring: unsafe { self.buffer_as_mut_slice() },
             },
         }
     }
@@ -2593,8 +2593,8 @@ fn from(other: VecDeque<T>) -> Self {
                         let mut right_offset = 0;
                         for i in left_edge..right_edge {
                             right_offset = (i - left_edge) % (cap - right_edge);
-                            let src = right_edge + right_offset;
-                            ptr::swap(buf.add(i), buf.add(src));
+                            let src: isize = (right_edge + right_offset) as isize;
+                            ptr::swap(buf.add(i), buf.offset(src));
                         }
                         let n_ops = right_edge - left_edge;
                         left_edge += n_ops;