From 2843e648c236c0ed31f0155f0805f43f3ee7ed95 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sat, 21 Apr 2018 23:22:27 +0200 Subject: [PATCH 1/2] turn `ManuallyDrop::new` into a constant function --- src/libcore/mem.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index e3f08926610..6d64d91312e 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -960,7 +960,7 @@ impl ManuallyDrop { /// ``` #[stable(feature = "manually_drop", since = "1.20.0")] #[inline] - pub fn new(value: T) -> ManuallyDrop { + pub const fn new(value: T) -> ManuallyDrop { ManuallyDrop { value: value } } From b61a4c20c6acd963070adb083b12d5e21a5843d3 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Mon, 7 May 2018 12:11:22 +0200 Subject: [PATCH 2/2] make the const constructor unstable --- src/libcore/mem.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 6d64d91312e..6836f8622b0 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -959,6 +959,7 @@ impl ManuallyDrop { /// ManuallyDrop::new(Box::new(())); /// ``` #[stable(feature = "manually_drop", since = "1.20.0")] + #[rustc_const_unstable(feature = "const_manually_drop_new")] #[inline] pub const fn new(value: T) -> ManuallyDrop { ManuallyDrop { value: value }