diff options
| author | Peter Lyons Kehl <peter.kehl@gmail.com> | 2025-09-22 11:40:53 -0700 |
|---|---|---|
| committer | Peter Lyons Kehl <peter.kehl@gmail.com> | 2025-09-22 12:51:50 -0700 |
| commit | 819f8b05b90adcf976d9b76e00fe3a9542781bf5 (patch) | |
| tree | e1d2b8eb39b68642af6abaa79577c472036d83d8 | |
| parent | 5d1b897a07dc30d810dd541795125c1c216266c7 (diff) | |
| download | rust-819f8b05b90adcf976d9b76e00fe3a9542781bf5.tar.gz rust-819f8b05b90adcf976d9b76e00fe3a9542781bf5.zip | |
Mutex/RwLock/ReentrantLock::data_ptr to be const fn
| -rw-r--r-- | library/std/src/sync/nonpoison/mutex.rs | 2 | ||||
| -rw-r--r-- | library/std/src/sync/nonpoison/rwlock.rs | 2 | ||||
| -rw-r--r-- | library/std/src/sync/poison/mutex.rs | 2 | ||||
| -rw-r--r-- | library/std/src/sync/poison/rwlock.rs | 2 | ||||
| -rw-r--r-- | library/std/src/sync/reentrant_lock.rs | 2 |
5 files changed, 5 insertions, 5 deletions
diff --git a/library/std/src/sync/nonpoison/mutex.rs b/library/std/src/sync/nonpoison/mutex.rs index 07430ce3a13..eeecf5d7107 100644 --- a/library/std/src/sync/nonpoison/mutex.rs +++ b/library/std/src/sync/nonpoison/mutex.rs @@ -373,7 +373,7 @@ impl<T: ?Sized> Mutex<T> { /// or written through after the mutex is dropped. #[unstable(feature = "mutex_data_ptr", issue = "140368")] // #[unstable(feature = "nonpoison_mutex", issue = "134645")] - pub fn data_ptr(&self) -> *mut T { + pub const fn data_ptr(&self) -> *mut T { self.data.get() } } diff --git a/library/std/src/sync/nonpoison/rwlock.rs b/library/std/src/sync/nonpoison/rwlock.rs index eb0aef99cc1..b2f26edc083 100644 --- a/library/std/src/sync/nonpoison/rwlock.rs +++ b/library/std/src/sync/nonpoison/rwlock.rs @@ -495,7 +495,7 @@ impl<T: ?Sized> RwLock<T> { /// or written through after the lock is dropped. #[unstable(feature = "rwlock_data_ptr", issue = "140368")] // #[unstable(feature = "nonpoison_rwlock", issue = "134645")] - pub fn data_ptr(&self) -> *mut T { + pub const fn data_ptr(&self) -> *mut T { self.data.get() } } diff --git a/library/std/src/sync/poison/mutex.rs b/library/std/src/sync/poison/mutex.rs index 7e9d920d92f..6fdb4f6799e 100644 --- a/library/std/src/sync/poison/mutex.rs +++ b/library/std/src/sync/poison/mutex.rs @@ -668,7 +668,7 @@ impl<T: ?Sized> Mutex<T> { /// are properly synchronized to avoid data races, and that it is not read /// or written through after the mutex is dropped. #[unstable(feature = "mutex_data_ptr", issue = "140368")] - pub fn data_ptr(&self) -> *mut T { + pub const fn data_ptr(&self) -> *mut T { self.data.get() } } diff --git a/library/std/src/sync/poison/rwlock.rs b/library/std/src/sync/poison/rwlock.rs index 0a463f3f9c7..e3a72c73bf4 100644 --- a/library/std/src/sync/poison/rwlock.rs +++ b/library/std/src/sync/poison/rwlock.rs @@ -667,7 +667,7 @@ impl<T: ?Sized> RwLock<T> { /// are properly synchronized to avoid data races, and that it is not read /// or written through after the lock is dropped. #[unstable(feature = "rwlock_data_ptr", issue = "140368")] - pub fn data_ptr(&self) -> *mut T { + pub const fn data_ptr(&self) -> *mut T { self.data.get() } } diff --git a/library/std/src/sync/reentrant_lock.rs b/library/std/src/sync/reentrant_lock.rs index 4140718560c..f560b616dd9 100644 --- a/library/std/src/sync/reentrant_lock.rs +++ b/library/std/src/sync/reentrant_lock.rs @@ -355,7 +355,7 @@ impl<T: ?Sized> ReentrantLock<T> { /// properly synchronized to avoid data races, and that it is not read /// through after the lock is dropped. #[unstable(feature = "reentrant_lock_data_ptr", issue = "140368")] - pub fn data_ptr(&self) -> *const T { + pub const fn data_ptr(&self) -> *const T { &raw const self.data } |
