Skip to content

Commit

Permalink
Rollup merge of rust-lang#103359 - WaffleLapkin:drain_no_mut_qqq, r=s…
Browse files Browse the repository at this point in the history
…cottmcm

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`.
  • Loading branch information
notriddle authored Oct 21, 2022
2 parents f60a29a + e97d295 commit 3ac87dd
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions library/alloc/src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 3ac87dd

Please sign in to comment.