mirror of
https://github.com/rust-lang/rust.git
synced 2025-12-30 01:04:35 +00:00
update docs, test
This commit is contained in:
parent
6469eb1c28
commit
9d19cbe29b
@ -735,13 +735,9 @@ impl<T> Vec<T> {
|
||||
unsafe { Self::from_parts_in(ptr, length, capacity, Global) }
|
||||
}
|
||||
|
||||
/// Returns a mutable reference to the greatest item in the binary heap, or
|
||||
/// Returns a mutable reference to the last item in the vector, or
|
||||
/// `None` if it is empty.
|
||||
///
|
||||
/// Note: If the `PeekMut` value is leaked, some heap elements might get
|
||||
/// leaked along with it, but the remaining elements will remain a valid
|
||||
/// heap.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Basic usage:
|
||||
|
||||
@ -2708,6 +2708,8 @@ fn test_peek_mut() {
|
||||
assert_eq!(*p, 2);
|
||||
*p = 0;
|
||||
assert_eq!(*p, 0);
|
||||
p.pop();
|
||||
assert_eq!(vec.len(), 1);
|
||||
} else {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user