Add test case for using slice::fill with MaybeUninit

This commit is contained in:
Katherine Philip 2021-08-30 13:19:50 -07:00
parent 6cfa773583
commit 8cecac2602

View File

@ -2144,3 +2144,12 @@ fn test_slice_run_destructors() {
assert_eq!(x.get(), 1);
}
#[test]
fn test_slice_fill_with_uninit() {
// This should not UB. See #87891
use core::mem::MaybeUninit;
let mut a = [MaybeUninit::<u8>::uninit(); 10];
a.fill(MaybeUninit::uninit());
}