about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJacob Kiesel <kieseljake@gmail.com>2017-09-18 10:15:17 -0600
committerGitHub <noreply@github.com>2017-09-18 10:15:17 -0600
commit10384ab18a386e6f7b58c714def62e405182d968 (patch)
tree7095a7708015b1437b4451fe2485256666b8aff9
parent4de0cf122d342fa6b1eb6eb30ae8a04d1d55353d (diff)
downloadrust-10384ab18a386e6f7b58c714def62e405182d968.tar.gz
rust-10384ab18a386e6f7b58c714def62e405182d968.zip
Add requested comment
-rw-r--r--src/liballoc/vec.rs3
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);
                 }
             }