vec: avoid some unsafe code in MoveIterator's dtor
This commit is contained in:
parent
7b42497453
commit
664c9af1e9
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user