diff options
| author | Jacob Kiesel <kieseljake@gmail.com> | 2017-09-18 10:15:17 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-09-18 10:15:17 -0600 |
| commit | 10384ab18a386e6f7b58c714def62e405182d968 (patch) | |
| tree | 7095a7708015b1437b4451fe2485256666b8aff9 | |
| parent | 4de0cf122d342fa6b1eb6eb30ae8a04d1d55353d (diff) | |
| download | rust-10384ab18a386e6f7b58c714def62e405182d968.tar.gz rust-10384ab18a386e6f7b58c714def62e405182d968.zip | |
Add requested comment
| -rw-r--r-- | src/liballoc/vec.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index cc0a60e747e..c5aaaac8f76 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -2694,6 +2694,9 @@ impl<'a, T, F> Iterator for DrainFilter<'a, T, F> let del = self.del; let src: *const T = &v[i]; 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); } } |
