about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-09-30 12:00:45 +0000
committerbors <bors@rust-lang.org>2018-09-30 12:00:45 +0000
commit1886d5fe1cdd1a016ecea9fc93d68b3052c528c8 (patch)
tree4a35a5e72fac81649886bf524b7ed3948671c463 /src/libcore
parenta677e4c347630b855f2889557c2d37180a1a41be (diff)
parent43cc32fbb2506eff0090e894c1e8a46b62a8eb0b (diff)
downloadrust-1886d5fe1cdd1a016ecea9fc93d68b3052c528c8.tar.gz
rust-1886d5fe1cdd1a016ecea9fc93d68b3052c528c8.zip
Auto merge of #54596 - mjbshaw:drop, r=RalfJung
Make core::mem::needs_drop a const fn

This fixes #51929.
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/mem.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs
index 9871f496678..f537add999a 100644
--- a/src/libcore/mem.rs
+++ b/src/libcore/mem.rs
@@ -455,6 +455,16 @@ pub fn align_of_val<T: ?Sized>(val: &T) -> usize {
 /// ```
 #[inline]
 #[stable(feature = "needs_drop", since = "1.21.0")]
+#[rustc_const_unstable(feature = "const_needs_drop")]
+#[cfg(not(stage0))]
+pub const fn needs_drop<T>() -> bool {
+    intrinsics::needs_drop::<T>()
+}
+
+#[inline]
+#[stable(feature = "needs_drop", since = "1.21.0")]
+#[cfg(stage0)]
+/// Ceci n'est pas la documentation
 pub fn needs_drop<T>() -> bool {
     unsafe { intrinsics::needs_drop::<T>() }
 }