From 2c3c8822e057c4ed972d0ce736b089c11afeaac3 Mon Sep 17 00:00:00 2001 From: Michael Bradshaw Date: Wed, 26 Sep 2018 14:46:14 -0700 Subject: [PATCH] Gate const core::mem::needs_drop behind const_needs_drop --- src/libcore/mem.rs | 1 + src/test/run-pass/const-needs_drop.rs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 13c0b89f5df..dd3775bff5e 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -483,6 +483,7 @@ pub fn align_of_val(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() -> bool { intrinsics::needs_drop::() diff --git a/src/test/run-pass/const-needs_drop.rs b/src/test/run-pass/const-needs_drop.rs index 2e381593b77..edf3a6b3dcd 100644 --- a/src/test/run-pass/const-needs_drop.rs +++ b/src/test/run-pass/const-needs_drop.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(const_needs_drop)] + use std::mem; struct Trivial(u8, f32);