Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,7 @@ Shohei Wada <[email protected]>
Shotaro Yamada <[email protected]>
Shotaro Yamada <[email protected]> <[email protected]>
Shyam Sundar B <[email protected]>
Sidney Cammeresi <[email protected]> <[email protected]>
Simon Barber-Dueck <[email protected]> Simon BD <simon@server>
Simon Sapin <[email protected]> <[email protected]>
Simonas Kazlauskas <[email protected]> Simonas Kazlauskas <[email protected]>
Expand Down
4 changes: 2 additions & 2 deletions library/alloc/src/vec/peek_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ impl<'a, T> PeekMut<'a, T> {

/// Removes the peeked value from the vector and returns it.
#[unstable(feature = "vec_peek_mut", issue = "122742")]
pub fn pop(self) -> T {
pub fn pop(this: Self) -> T {
// SAFETY: PeekMut is only constructed if the vec is non-empty
unsafe { self.vec.pop().unwrap_unchecked() }
unsafe { this.vec.pop().unwrap_unchecked() }
}
}

Expand Down
4 changes: 2 additions & 2 deletions library/alloctests/tests/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use std::ops::Bound::*;
use std::panic::{AssertUnwindSafe, catch_unwind};
use std::rc::Rc;
use std::sync::atomic::{AtomicU32, Ordering};
use std::vec::{Drain, IntoIter};
use std::vec::{Drain, IntoIter, PeekMut};

use crate::testing::macros::struct_with_counted_drop;

Expand Down Expand Up @@ -2647,7 +2647,7 @@ fn test_peek_mut() {
assert_eq!(*p, 2);
*p = 0;
assert_eq!(*p, 0);
p.pop();
PeekMut::pop(p);
assert_eq!(vec.len(), 1);
} else {
unreachable!()
Expand Down
Loading