mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-25 15:04:33 +00:00
Add requested comment
This commit is contained in:
parent
4de0cf122d
commit
10384ab18a
@ -2694,6 +2694,9 @@ impl<'a, T, F> Iterator for DrainFilter<'a, T, F>
|
|||||||
let del = self.del;
|
let del = self.del;
|
||||||
let src: *const T = &v[i];
|
let src: *const T = &v[i];
|
||||||
let dst: *mut T = &mut v[i - del];
|
let dst: *mut T = &mut v[i - del];
|
||||||
|
// This is safe because self.vec has length 0
|
||||||
|
// thus its elements will not have Drop::drop
|
||||||
|
// called on them in the event of a panic.
|
||||||
ptr::copy_nonoverlapping(src, dst, 1);
|
ptr::copy_nonoverlapping(src, dst, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user