From db9a53b5d7dcf2be60496a6ee19f03476d354344 Mon Sep 17 00:00:00 2001 From: Albin Hedman Date: Sat, 13 Mar 2021 20:43:47 +0100 Subject: [PATCH] Constify mem::transmute_copy --- library/core/src/mem/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/core/src/mem/mod.rs b/library/core/src/mem/mod.rs index a02c400557b48..37e8d65db6a38 100644 --- a/library/core/src/mem/mod.rs +++ b/library/core/src/mem/mod.rs @@ -933,7 +933,8 @@ pub fn drop(_x: T) {} /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] -pub unsafe fn transmute_copy(src: &T) -> U { +#[rustc_const_unstable(feature = "const_transmute_copy", issue = "83165")] +pub const unsafe fn transmute_copy(src: &T) -> U { // If U has a higher alignment requirement, src may not be suitably aligned. if align_of::() > align_of::() { // SAFETY: `src` is a reference which is guaranteed to be valid for reads.