vec: avoid some unsafe code in MoveIterator's dtor

This commit is contained in:
Daniel Micay 2013-12-16 08:58:41 -05:00
parent 7b42497453
commit 664c9af1e9

View File

@ -2695,11 +2695,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 {