Rollup merge of #88507 - atsuzaki:slice-fill-maybeuninit-test, r=RalfJung
Add test case for using `slice::fill` with MaybeUninit Adds test for #87891 Looks alright? `@RalfJung` Fixes #87891
This commit is contained in:
commit
80b572b5e5
1 changed files with 8 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
use core::cell::Cell;
|
||||
use core::cmp::Ordering;
|
||||
use core::mem::MaybeUninit;
|
||||
use core::result::Result::{Err, Ok};
|
||||
|
||||
#[test]
|
||||
|
@ -2144,3 +2145,10 @@ fn test_slice_run_destructors() {
|
|||
|
||||
assert_eq!(x.get(), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_slice_fill_with_uninit() {
|
||||
// This should not UB. See #87891
|
||||
let mut a = [MaybeUninit::<u8>::uninit(); 10];
|
||||
a.fill(MaybeUninit::uninit());
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue