Skip to content

Commit 6e7b563

Browse files
committed
const mem::drop
1 parent 235a4c0 commit 6e7b563

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

library/core/src/mem/mod.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#![stable(feature = "rust1", since = "1.0.0")]
77

88
use crate::alloc::Layout;
9-
use crate::marker::DiscriminantKind;
9+
use crate::marker::{Destruct, DiscriminantKind};
1010
use crate::panic::const_assert;
1111
use crate::{clone, cmp, fmt, hash, intrinsics, ptr};
1212

@@ -958,8 +958,13 @@ pub const fn replace<T>(dest: &mut T, src: T) -> T {
958958
/// [`RefCell`]: crate::cell::RefCell
959959
#[inline]
960960
#[stable(feature = "rust1", since = "1.0.0")]
961+
#[rustc_const_unstable(feature = "const_destruct", issue = "133214")]
961962
#[rustc_diagnostic_item = "mem_drop"]
962-
pub fn drop<T>(_x: T) {}
963+
pub const fn drop<T>(_x: T)
964+
where
965+
T: [const] Destruct,
966+
{
967+
}
963968

964969
/// Bitwise-copies a value.
965970
///

0 commit comments

Comments
 (0)