Skip to content

Commit a9a333b

Browse files
authored
Unrolled build for #146546
Rollup merge of #146546 - cammeresi:pop, r=Mark-Simulacrum Switch `std::vec::PeekMut::pop` from self to this parameter. Since PeekMut implements Deref, it shouldn't have any methods of its own. See also: `std::collections::binary_heap::PeekMut::pop` Pointed out: #122742 (comment) Related: #122742
2 parents a454fcc + ce859d7 commit a9a333b

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,7 @@ Shohei Wada <[email protected]>
609609
Shotaro Yamada <[email protected]>
610610
611611
Shyam Sundar B <[email protected]>
612+
612613
Simon Barber-Dueck <[email protected]> Simon BD <simon@server>
613614
614615
Simonas Kazlauskas <[email protected]> Simonas Kazlauskas <[email protected]>

library/alloc/src/vec/peek_mut.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ impl<'a, T> PeekMut<'a, T> {
2929

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

library/alloctests/tests/vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use std::ops::Bound::*;
1515
use std::panic::{AssertUnwindSafe, catch_unwind};
1616
use std::rc::Rc;
1717
use std::sync::atomic::{AtomicU32, Ordering};
18-
use std::vec::{Drain, IntoIter};
18+
use std::vec::{Drain, IntoIter, PeekMut};
1919

2020
use crate::testing::macros::struct_with_counted_drop;
2121

@@ -2647,7 +2647,7 @@ fn test_peek_mut() {
26472647
assert_eq!(*p, 2);
26482648
*p = 0;
26492649
assert_eq!(*p, 0);
2650-
p.pop();
2650+
PeekMut::pop(p);
26512651
assert_eq!(vec.len(), 1);
26522652
} else {
26532653
unreachable!()

0 commit comments

Comments
 (0)