diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-09-23 23:40:29 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-23 23:40:29 +0200 |
| commit | bba509eb7ee9d20a7300b6d34bcfffbe84e9d31d (patch) | |
| tree | 3f504f0296fc6eea83e728b354cc73717570873c /library/std/src | |
| parent | f984966325bbfd81b385a8b8b6d1141059749c96 (diff) | |
| parent | 819f8b05b90adcf976d9b76e00fe3a9542781bf5 (diff) | |
| download | rust-bba509eb7ee9d20a7300b6d34bcfffbe84e9d31d.tar.gz rust-bba509eb7ee9d20a7300b6d34bcfffbe84e9d31d.zip | |
Rollup merge of #146904 - peter-lyons-kehl:140368_data_ptr_const_fn, r=Amanieu
#140368 Mutex/RwLock/ReentrantLock::data_ptr to be const fn
Diffstat (limited to 'library/std/src')
| -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 } |
