about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--library/core/src/mem/maybe_uninit.rs2
-rw-r--r--library/core/tests/mem.rs2
2 files changed, 3 insertions, 1 deletions
diff --git a/library/core/src/mem/maybe_uninit.rs b/library/core/src/mem/maybe_uninit.rs
index fda0553f94c..05bcd90d3ca 100644
--- a/library/core/src/mem/maybe_uninit.rs
+++ b/library/core/src/mem/maybe_uninit.rs
@@ -839,7 +839,7 @@ impl<T> MaybeUninit<T> {
         // * MaybeUnint does not drop, so there are no double-frees
         // And thus the conversion is safe
         unsafe {
-            intrinsics::assert_inhabited::<T>();
+            intrinsics::assert_inhabited::<[T; N]>();
             (&array as *const _ as *const [T; N]).read()
         }
     }
diff --git a/library/core/tests/mem.rs b/library/core/tests/mem.rs
index 2279a16429f..38084f401bc 100644
--- a/library/core/tests/mem.rs
+++ b/library/core/tests/mem.rs
@@ -152,6 +152,8 @@ fn uninit_array_assume_init() {
     let array = unsafe { MaybeUninit::array_assume_init(array) };
 
     assert_eq!(array, [3, 1, 4, 1, 5]);
+
+    let [] = unsafe { MaybeUninit::<!>::array_assume_init([]) };
 }
 
 #[test]