mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 23:34:48 +00:00
Add test case for using slice::fill
with MaybeUninit
This commit is contained in:
parent
6cfa773583
commit
8cecac2602
@ -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());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user