diff --git a/library/core/src/mem/maybe_uninit.rs b/library/core/src/mem/maybe_uninit.rs index fda0553f94c5f..05bcd90d3ca76 100644 --- a/library/core/src/mem/maybe_uninit.rs +++ b/library/core/src/mem/maybe_uninit.rs @@ -839,7 +839,7 @@ impl MaybeUninit { // * MaybeUnint does not drop, so there are no double-frees // And thus the conversion is safe unsafe { - intrinsics::assert_inhabited::(); + 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 2279a16429f98..38084f401bce6 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]