about summary refs log tree commit diff
path: root/src/libcore/macros.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcore/macros.rs')
-rw-r--r--src/libcore/macros.rs23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs
index 293a2dd9492..9855c5fb9c3 100644
--- a/src/libcore/macros.rs
+++ b/src/libcore/macros.rs
@@ -626,20 +626,37 @@ macro_rules! todo {
 /// Creates an array of [`MaybeUninit`].
 ///
 /// This macro constructs an uninitialized array of the type `[MaybeUninit<K>; N]`.
+/// It exists solely because bootstrap does not yet support const array-init expressions.
 ///
 /// [`MaybeUninit`]: mem/union.MaybeUninit.html
+// FIXME: Remove both versions of this macro once bootstrap is 1.38.
 #[macro_export]
 #[unstable(feature = "maybe_uninit_array", issue = "53491")]
-macro_rules! uninitialized_array {
+#[cfg(bootstrap)]
+macro_rules! uninit_array {
     // This `assume_init` is safe because an array of `MaybeUninit` does not
     // require initialization.
-    // FIXME(#49147): Could be replaced by an array initializer, once those can
-    // be any const expression.
     ($t:ty; $size:expr) => (unsafe {
         MaybeUninit::<[MaybeUninit<$t>; $size]>::uninit().assume_init()
     });
 }
 
+/// Creates an array of [`MaybeUninit`].
+///
+/// This macro constructs an uninitialized array of the type `[MaybeUninit<K>; N]`.
+/// It exists solely because bootstrap does not yet support const array-init expressions.
+///
+/// [`MaybeUninit`]: mem/union.MaybeUninit.html
+// FIXME: Just inline this version of the macro once bootstrap is 1.38.
+#[macro_export]
+#[unstable(feature = "maybe_uninit_array", issue = "53491")]
+#[cfg(not(bootstrap))]
+macro_rules! uninit_array {
+    ($t:ty; $size:expr) => (
+        [MaybeUninit::<$t>::uninit(); $size]
+    );
+}
+
 /// Built-in macros to the compiler itself.
 ///
 /// These macros do not have any corresponding definition with a `macro_rules!`