Skip to content

Commit

Permalink
Make ptr::from_ref and ptr::from_mut in rust-lang#106116 const.
Browse files Browse the repository at this point in the history
  • Loading branch information
Raekye committed Mar 9, 2023
1 parent 39f2657 commit e8fbf62
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/core/src/ptr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ where
#[inline(always)]
#[must_use]
#[unstable(feature = "ptr_from_ref", issue = "106116")]
pub fn from_ref<T: ?Sized>(r: &T) -> *const T {
pub const fn from_ref<T: ?Sized>(r: &T) -> *const T {
r
}

Expand All @@ -702,7 +702,7 @@ pub fn from_ref<T: ?Sized>(r: &T) -> *const T {
#[inline(always)]
#[must_use]
#[unstable(feature = "ptr_from_ref", issue = "106116")]
pub fn from_mut<T: ?Sized>(r: &mut T) -> *mut T {
pub const fn from_mut<T: ?Sized>(r: &mut T) -> *mut T {
r
}

Expand Down

0 comments on commit e8fbf62

Please sign in to comment.