From fc4056ec78ca113d5296634cb59c9dd3325c1153 Mon Sep 17 00:00:00 2001 From: nxsaken Date: Sun, 9 Nov 2025 20:21:12 +0400 Subject: [PATCH 1/2] Constify `ManuallyDrop::take` --- library/core/src/mem/manually_drop.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/core/src/mem/manually_drop.rs b/library/core/src/mem/manually_drop.rs index 334a4b7119a11..b2328fcf7d844 100644 --- a/library/core/src/mem/manually_drop.rs +++ b/library/core/src/mem/manually_drop.rs @@ -217,8 +217,9 @@ impl ManuallyDrop { /// #[must_use = "if you don't need the value, you can use `ManuallyDrop::drop` instead"] #[stable(feature = "manually_drop_take", since = "1.42.0")] + #[rustc_const_unstable(feature = "const_manually_drop_take", issue = "none")] #[inline] - pub unsafe fn take(slot: &mut ManuallyDrop) -> T { + pub const unsafe fn take(slot: &mut ManuallyDrop) -> T { // SAFETY: we are reading from a reference, which is guaranteed // to be valid for reads. unsafe { ptr::read(&slot.value) } From 1d9be661a8e1998616692d780cc617c6ac3fe386 Mon Sep 17 00:00:00 2001 From: nxsaken Date: Mon, 10 Nov 2025 09:38:04 +0400 Subject: [PATCH 2/2] Add tracking issue number --- library/core/src/mem/manually_drop.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/mem/manually_drop.rs b/library/core/src/mem/manually_drop.rs index b2328fcf7d844..7d49da8509577 100644 --- a/library/core/src/mem/manually_drop.rs +++ b/library/core/src/mem/manually_drop.rs @@ -217,7 +217,7 @@ impl ManuallyDrop { /// #[must_use = "if you don't need the value, you can use `ManuallyDrop::drop` instead"] #[stable(feature = "manually_drop_take", since = "1.42.0")] - #[rustc_const_unstable(feature = "const_manually_drop_take", issue = "none")] + #[rustc_const_unstable(feature = "const_manually_drop_take", issue = "148773")] #[inline] pub const unsafe fn take(slot: &mut ManuallyDrop) -> T { // SAFETY: we are reading from a reference, which is guaranteed