diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-03-10 12:32:01 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-10 12:32:01 +0100 |
| commit | 65db3cb794cdde6010e1ab0a9a92b681c4aca34e (patch) | |
| tree | 8f983139afa73f4e6f332de476523b923db90ad5 | |
| parent | e0c8ba19299bcf6609d4e72d6afb140e1f225458 (diff) | |
| parent | e8fbf6205e99172254a0b130819abc9e6711f2bc (diff) | |
| download | rust-65db3cb794cdde6010e1ab0a9a92b681c4aca34e.tar.gz rust-65db3cb794cdde6010e1ab0a9a92b681c4aca34e.zip | |
Rollup merge of #108956 - Raekye:master, r=scottmcm
Make ptr::from_ref and ptr::from_mut in #106116 const. As per https://github.com/rust-lang/rust/issues/106116#issuecomment-1462571833
| -rw-r--r-- | library/core/src/ptr/mod.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs index 1ad9af1549a..f41be46abc9 100644 --- a/library/core/src/ptr/mod.rs +++ b/library/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<T: ?Sized>(r: &T) -> *const T { +pub const fn from_ref<T: ?Sized>(r: &T) -> *const T { r } @@ -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 } |
