From b51d3b9443e0da9246d9017d93da2a25d93bc89b Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Sun, 5 Feb 2023 17:03:16 -0500 Subject: [PATCH] Mark 'atomic_mut_ptr' methods const --- library/core/src/sync/atomic.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/library/core/src/sync/atomic.rs b/library/core/src/sync/atomic.rs index 818721062d7f7..1d14efc7523b4 100644 --- a/library/core/src/sync/atomic.rs +++ b/library/core/src/sync/atomic.rs @@ -928,8 +928,8 @@ impl AtomicBool { /// ``` #[inline] #[unstable(feature = "atomic_mut_ptr", reason = "recently added", issue = "66893")] - pub fn as_mut_ptr(&self) -> *mut bool { - self.v.get() as *mut bool + pub const fn as_mut_ptr(&self) -> *mut bool { + self.v.get().cast() } /// Fetches the value, and applies a function to it that returns an optional @@ -1803,7 +1803,7 @@ impl AtomicPtr { /// /// ```ignore (extern-declaration) /// #![feature(atomic_mut_ptr)] - //// use std::sync::atomic::AtomicPtr; + /// use std::sync::atomic::AtomicPtr; /// /// extern "C" { /// fn my_atomic_op(arg: *mut *mut u32); @@ -1819,7 +1819,7 @@ impl AtomicPtr { /// ``` #[inline] #[unstable(feature = "atomic_mut_ptr", reason = "recently added", issue = "66893")] - pub fn as_mut_ptr(&self) -> *mut *mut T { + pub const fn as_mut_ptr(&self) -> *mut *mut T { self.p.get() } } @@ -2727,7 +2727,7 @@ macro_rules! atomic_int { #[unstable(feature = "atomic_mut_ptr", reason = "recently added", issue = "66893")] - pub fn as_mut_ptr(&self) -> *mut $int_type { + pub const fn as_mut_ptr(&self) -> *mut $int_type { self.v.get() } }