From de1a85ec3ed04b7a241ec36a5c475ad0fd66d728 Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Sun, 14 Jan 2024 08:20:32 -0700 Subject: [PATCH] Match `core`'s definition of `uninit_array` Since we specifically bound on `ArrayType = [T; N]` it's possible to write that directly. Using the exact same code as core should help ensure and inspire confidence that it's implemented correctly. Note: a TODO still suggests using the upstream `core` method when it's been stabilized --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index eebdc3b..df9bf36 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -225,7 +225,7 @@ where // See how `core` defines `MaybeUninit::uninit_array` for a similar example: // // TODO(tarcieri): use `MaybeUninit::uninit_array` when stable - Self(unsafe { MaybeUninit::>>::uninit().assume_init() }) + Self(unsafe { MaybeUninit::<[MaybeUninit; N]>::uninit().assume_init() }) } /// Extract the values from an array of `MaybeUninit` containers.