about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/vec.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs
index 25a6429d851..65be214c14e 100644
--- a/src/libstd/vec.rs
+++ b/src/libstd/vec.rs
@@ -2673,11 +2673,9 @@ impl<T> DoubleEndedIterator<T> for MoveIterator<T> {
 #[unsafe_destructor]
 impl<T> Drop for MoveIterator<T> {
     fn drop(&mut self) {
+        // destroy the remaining elements
+        for _x in *self {}
         unsafe {
-            // destroy the remaining elements
-            for x in self.iter {
-                ptr::read_ptr(x);
-            }
             if owns_managed::<T>() {
                 local_free(self.allocation as *u8 as *c_char)
             } else {