fix tests
This commit is contained in:
parent
188c40126d
commit
cc80429021
4 changed files with 9 additions and 4 deletions
|
|
@ -747,6 +747,7 @@ impl<T> Vec<T> {
|
|||
/// Basic usage:
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(vec_peek_mut)]
|
||||
/// let mut vec = Vec::new();
|
||||
/// assert!(vec.peek_mut().is_none());
|
||||
///
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@
|
|||
#![feature(trusted_random_access)]
|
||||
#![feature(try_reserve_kind)]
|
||||
#![feature(try_trait_v2)]
|
||||
#![feature(vec_peek_mut)]
|
||||
// tidy-alphabetical-end
|
||||
//
|
||||
// Language features:
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
#![feature(vec_deque_truncate_front)]
|
||||
#![feature(unique_rc_arc)]
|
||||
#![feature(macro_metavar_expr_concat)]
|
||||
#![feature(vec_peek_mut)]
|
||||
#![allow(internal_features)]
|
||||
#![deny(fuzzy_provenance_casts)]
|
||||
#![deny(unsafe_op_in_unsafe_fn)]
|
||||
|
|
|
|||
|
|
@ -2704,9 +2704,13 @@ fn test_peek_mut() {
|
|||
assert!(vec.peek_mut().is_none());
|
||||
vec.push(1);
|
||||
vec.push(2);
|
||||
assert_eq!(vec.peek_mut(), Some(2));
|
||||
*vec.peek_mut() = 0;
|
||||
assert_eq!(vec.peek_mut(), Some(0));
|
||||
if let Some(mut p) = vec.peek_mut() {
|
||||
assert_eq!(*p, 2);
|
||||
*p = 0;
|
||||
assert_eq!(*p, 0);
|
||||
} else {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
/// This assortment of tests, in combination with miri, verifies we handle UB on fishy arguments
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue