]> git.lizzy.rs Git - rust.git/blobdiff - library/core/tests/slice.rs
Auto merge of #88219 - jyn514:parallel-io, r=GuillaumeGomez
[rust.git] / library / core / tests / slice.rs
index 43e2af3eb18d262403b9788e5db808a113ee1a64..c591dd3e1a6dbbca75aa3af7e1266f25affae5f0 100644 (file)
@@ -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 foo(x: &Cell<isize>) -> Foo<'_> {
 
     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());
+}