Clarify double-drop comment

This commit is contained in:
Aaron Loucks 2019-07-07 16:36:19 -04:00
parent a4a6a67a01
commit df5b32ee9b

View File

@ -2825,7 +2825,7 @@ impl<T, F> Drop for DrainFilter<'_, T, F>
// to execute `pred`, so we just backshift all the unprocessed
// elements and tell the vec that they still exist. The backshift
// is required to prevent a double-drop of the last successfully
// drained item following a panic in the predicate.
// drained item prior to a panic in the predicate.
let ptr = self.drain.vec.as_mut_ptr();
let src = ptr.add(self.drain.idx);
let dst = src.sub(self.drain.del);