From 71f8ba339a2e179e0a740370ff862f5ccdfe4134 Mon Sep 17 00:00:00 2001 From: Raekye Date: Thu, 9 Mar 2023 16:36:20 -0500 Subject: [PATCH] Make ptr::from_ref and ptr::from_mut in #106116 const. --- core/src/ptr/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/ptr/mod.rs b/core/src/ptr/mod.rs index 1ad9af154..f41be46ab 100644 --- a/core/src/ptr/mod.rs +++ b/core/src/ptr/mod.rs @@ -691,7 +691,7 @@ where #[inline(always)] #[must_use] #[unstable(feature = "ptr_from_ref", issue = "106116")] -pub fn from_ref(r: &T) -> *const T { +pub const fn from_ref(r: &T) -> *const T { r } @@ -702,7 +702,7 @@ pub fn from_ref(r: &T) -> *const T { #[inline(always)] #[must_use] #[unstable(feature = "ptr_from_ref", issue = "106116")] -pub fn from_mut(r: &mut T) -> *mut T { +pub const fn from_mut(r: &mut T) -> *mut T { r }