Skip to content

Commit 10384ab

Browse files
authored
Add requested comment
1 parent 4de0cf1 commit 10384ab

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/liballoc/vec.rs

+3
Original file line numberDiff line numberDiff line change
@@ -2694,6 +2694,9 @@ impl<'a, T, F> Iterator for DrainFilter<'a, T, F>
26942694
let del = self.del;
26952695
let src: *const T = &v[i];
26962696
let dst: *mut T = &mut v[i - del];
2697+
// This is safe because self.vec has length 0
2698+
// thus its elements will not have Drop::drop
2699+
// called on them in the event of a panic.
26972700
ptr::copy_nonoverlapping(src, dst, 1);
26982701
}
26992702
}

0 commit comments

Comments
 (0)