about summary refs log tree commit diff
path: root/library/alloc/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-10-22 00:14:03 +0200
committerGitHub <noreply@github.com>2022-10-22 00:14:03 +0200
commit1b2f594f48a9e6424d7120212ac66446efb489d9 (patch)
treee8fd87cffc61e772f31fbc0c05fb53e8d36d5358 /library/alloc/src
parented430ca5feaffeeb78f16198f3a7df21a51903ee (diff)
parente97d295d0078b03212cecb91854b979e4757ba72 (diff)
downloadrust-1b2f594f48a9e6424d7120212ac66446efb489d9.tar.gz
rust-1b2f594f48a9e6424d7120212ac66446efb489d9.zip
Rollup merge of #103359 - WaffleLapkin:drain_no_mut_qqq, r=scottmcm
Remove incorrect comment in `Vec::drain`

r? ``@scottmcm``

Turns out this comment wasn't correct for 6 years, since #34951, which switched from using `slice::IterMut` into using `slice::Iter`.
Diffstat (limited to 'library/alloc/src')
-rw-r--r--library/alloc/src/vec/mod.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs
index b5b2eb0ece0..6a71f08330c 100644
--- a/library/alloc/src/vec/mod.rs
+++ b/library/alloc/src/vec/mod.rs
@@ -1999,9 +1999,7 @@ impl<T, A: Allocator> Vec<T, A> {
         unsafe {
             // set self.vec length's to start, to be safe in case Drain is leaked
             self.set_len(start);
-            // Use the borrow in the IterMut to indicate borrowing behavior of the
-            // whole Drain iterator (like &mut T).
-            let range_slice = slice::from_raw_parts_mut(self.as_mut_ptr().add(start), end - start);
+            let range_slice = slice::from_raw_parts(self.as_ptr().add(start), end - start);
             Drain {
                 tail_start: end,
                 tail_len: len - end,