Add requested comment

This commit is contained in:
Jacob Kiesel 2017-09-18 10:15:17 -06:00 committed by GitHub
parent 4de0cf122d
commit 10384ab18a

View File

@ -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);
} }
} }