Skip to content

Commit 3ac87dd

Browse files
authored
Rollup merge of rust-lang#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 rust-lang#34951, which switched from using `slice::IterMut` into using `slice::Iter`.
2 parents f60a29a + e97d295 commit 3ac87dd

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

library/alloc/src/vec/mod.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1999,9 +1999,7 @@ impl<T, A: Allocator> Vec<T, A> {
19991999
unsafe {
20002000
// set self.vec length's to start, to be safe in case Drain is leaked
20012001
self.set_len(start);
2002-
// Use the borrow in the IterMut to indicate borrowing behavior of the
2003-
// whole Drain iterator (like &mut T).
2004-
let range_slice = slice::from_raw_parts_mut(self.as_mut_ptr().add(start), end - start);
2002+
let range_slice = slice::from_raw_parts(self.as_ptr().add(start), end - start);
20052003
Drain {
20062004
tail_start: end,
20072005
tail_len: len - end,

0 commit comments

Comments
 (0)