Skip to content

Commit fc4056e

Browse files
committed
Constify ManuallyDrop::take
1 parent ab67c37 commit fc4056e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

library/core/src/mem/manually_drop.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,9 @@ impl<T> ManuallyDrop<T> {
217217
///
218218
#[must_use = "if you don't need the value, you can use `ManuallyDrop::drop` instead"]
219219
#[stable(feature = "manually_drop_take", since = "1.42.0")]
220+
#[rustc_const_unstable(feature = "const_manually_drop_take", issue = "none")]
220221
#[inline]
221-
pub unsafe fn take(slot: &mut ManuallyDrop<T>) -> T {
222+
pub const unsafe fn take(slot: &mut ManuallyDrop<T>) -> T {
222223
// SAFETY: we are reading from a reference, which is guaranteed
223224
// to be valid for reads.
224225
unsafe { ptr::read(&slot.value) }

0 commit comments

Comments
 (0)